Checkbox
A box that is ticked or not, with its label and hint beside it; pressing the label ticks it too.
Stability: experimental
Props
| Prop | Type | Default | Means |
|---|---|---|---|
label | string | The text beside the box, and its accessible name. | |
hint | string | A second line. | |
checked | boolean | bindable(false) | Whether it is ticked. Bind it with bind:checked={name}. |
disabled | boolean | false | Cannot be ticked or focused. |
States
| State | Looks like |
|---|---|
ticked | Filled primary with a check mark. |
focused | The focus outline. |
disabled | 50% opacity. |
Accessibility
| role | checkbox |
| name | The label prop. |
| focus | Tab reaches it; Shift+Tab leaves it. A disabled one is skipped. |
| keyboard | Space ticks and unticks it. |
| notes | The 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} />