Chip
A small toggle for filtering, such as Open now or Vegan, that stays pressed in while it is on.
Stability: experimental
Props
| Prop | Type | Default | Means |
|---|---|---|---|
label | string | The chip's text and accessible name. | |
selected | boolean | bindable(false) | Whether the chip is on. Bind it with bind:selected={name}. |
icon | string | An icon before the label while the chip is off; a tick replaces it while on. | |
disabled | boolean | false | Cannot be pressed or focused. |
onPress | () => void | Runs instead of flipping selected, so the placing file decides, as ChipGroup does. |
States
| State | Looks like |
|---|---|
on | Primary border and text, a primary-tinted surface and a tick. |
pressed | Shrinks to 96%. |
focused | The focus outline. |
disabled | 45% opacity. |
Accessibility
| role | button with aria-pressed (a toggle button). Decision 0039 chose aria-pressed over checkboxes. |
| name | The label prop. |
| focus | Tab reaches each chip; a disabled one is skipped. |
| keyboard | Enter or Space flips it. |
Theme tokens
color.ink color.surface color.border color.primary space.3 radius.full text.caption
Example
<Chip label="Open now" icon="clock" bind:selected={openNow} />