Duolith docs

ChipGroup

A labelled, wrapping set of filter chips: one chosen at a time, or several with multiple.

Stability: experimental

Props

PropTypeDefaultMeans
labelstringThe label above the chips, and the group's accessible name.
options{ value: string; label: string; icon?: string }[]The chips.
valuestringbindable("")The chosen value, or "" for none, when one chip is on at a time. Bind it with bind:value={name}.
valuesstring[]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).
multiplebooleanfalseSeveral chips may be on at once.
disabledbooleanfalseNo chip can be pressed.

States

StateLooks like
chosenThe chosen chips look on (see Chip).
disabledEvery chip at 45% opacity.

Accessibility

rolegroup, 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.
nameThe label prop; each chip by its text.
focusEach chip is a Tab stop, in order.
keyboardEnter 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} />