Chip
chip · Elements · interactive
A pill you can press, or take off.
Import
cpp
#include "gbui/widgets/chip.hpp"Example
cpp
ChipResult chip(Ui& ui, const Interaction& input, std::string_view id, std::string_view label, const ChipOptions& options = {});A pressable pill. Enter and Space press it; when it is removable, Delete and Backspace remove it while it has focus — which is the gesture every tag field on the web has and the reason a removable chip needs no pointer at all.
API
ChipOptions
| Option | Type | Default | What it does |
|---|---|---|---|
selected | bool | false | Drawn as chosen: filled rather than outlined, and announced as pressed. This is what a filter chip is for. A chip that only ever looks the same is a label with a cursor on it. |
removable | bool | false | An × at the trailing edge, and a second thing to press. |
leading optional | std::optional<Icon> | A glyph before the label. | |
disabled | bool | false | |
name | std::string_view | What it is called, when the label is not enough on its own — "main" on a branch chip is a word, not a sentence. | |
color | Token | Token::Accent |