Duolith docs

Chip

A small toggle for filtering, such as Open now or Vegan, that stays pressed in while it is on.

Stability: experimental

Props

PropTypeDefaultMeans
labelstringThe chip's text and accessible name.
selectedbooleanbindable(false)Whether the chip is on. Bind it with bind:selected={name}.
iconstringAn icon before the label while the chip is off; a tick replaces it while on.
disabledbooleanfalseCannot be pressed or focused.
onPress() => voidRuns instead of flipping selected, so the placing file decides, as ChipGroup does.

States

StateLooks like
onPrimary border and text, a primary-tinted surface and a tick.
pressedShrinks to 96%.
focusedThe focus outline.
disabled45% opacity.

Accessibility

rolebutton with aria-pressed (a toggle button). Decision 0039 chose aria-pressed over checkboxes.
nameThe label prop.
focusTab reaches each chip; a disabled one is skipped.
keyboardEnter 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} />