ChipGroup
A labelled, wrapping set of filter chips: one chosen at a time, or several with multiple.
Stability: experimental
Props
| Prop | Type | Default | Means |
|---|---|---|---|
label | string | The label above the chips, and the group's accessible name. | |
options | { value: string; label: string; icon?: string }[] | The chips. | |
value | string | bindable("") | The chosen value, or "" for none, when one chip is on at a time. Bind it with bind:value={name}. |
values | string[] | bindable([]) | With multiple, the list of chosen values. Bind it with bind:values={names}. A separate prop from value, so each binding has one type (decision 0097). |
multiple | boolean | false | Several chips may be on at once. |
disabled | boolean | false | No chip can be pressed. |
States
| State | Looks like |
|---|---|
chosen | The chosen chips look on (see Chip). |
disabled | Every chip at 45% opacity. |
Accessibility
| role | group, each chip a button with aria-pressed. Toggle buttons, not radios or checkboxes, in both modes (decision 0039): pressing the chosen chip unchooses it, which a radio cannot do. |
| name | The label prop; each chip by its text. |
| focus | Each chip is a Tab stop, in order. |
| keyboard | Enter or Space chooses or unchooses the focused chip. |
Theme tokens
color.ink color.surface color.border color.primary space.2 space.3 radius.full text.label text.caption
Example
<ChipGroup label="Diet" multiple options={diets} bind:values={chosenDiets} />