ToggleRow
A row with a label, an optional hint and icon, and a switch.
Stability: experimental
Props
| Prop | Type | Default | Means |
|---|---|---|---|
label | string | The row's text, and the switch's accessible name. | |
hint | string | A second line. | |
icon | string | A leading icon on a tinted tile. | |
checked | boolean | bindable(false) | Whether the switch is on. Bind it with bind:checked={name}. |
disabled | boolean | false | Cannot be flipped or focused. |
onChange | (checked: boolean) => void | Runs when the user flips it. |
States
| State | Looks like |
|---|---|
on | The track turns primary. |
focused | The focus outline on the switch. |
disabled | The switch and text dim. |
Accessibility
| role | switch |
| name | The label prop. |
| focus | Tab reaches it; Shift+Tab leaves it. A disabled one is skipped. |
| keyboard | Space flips it. |
| notes | The hint describes the switch (aria-describedby). |
Theme tokens
color.surface color.primary color.border color.ink color.muted space.3 space.4 radius.sm text.body text.caption
Example
<ToggleRow label="Notifications" bind:checked={notifications} />