Duolith docs

Checkbox

A box that is ticked or not, with its label and hint beside it; pressing the label ticks it too.

Stability: experimental

Props

PropTypeDefaultMeans
labelstringThe text beside the box, and its accessible name.
hintstringA second line.
checkedbooleanbindable(false)Whether it is ticked. Bind it with bind:checked={name}.
disabledbooleanfalseCannot be ticked or focused.

States

StateLooks like
tickedFilled primary with a check mark.
focusedThe focus outline.
disabled50% opacity.

Accessibility

rolecheckbox
nameThe label prop.
focusTab reaches it; Shift+Tab leaves it. A disabled one is skipped.
keyboardSpace ticks and unticks it.
notesThe hint describes the box (aria-describedby).

Theme tokens

color.surface color.primary color.on-primary color.muted color.ink radius.xs space.2 space.3 text.body text.caption

Example

<Checkbox label="I accept the terms" bind:checked={accepted} />