Duolith docs

ToggleRow

A row with a label, an optional hint and icon, and a switch.

Stability: experimental

Props

PropTypeDefaultMeans
labelstringThe row's text, and the switch's accessible name.
hintstringA second line.
iconstringA leading icon on a tinted tile.
checkedbooleanbindable(false)Whether the switch is on. Bind it with bind:checked={name}.
disabledbooleanfalseCannot be flipped or focused.
onChange(checked: boolean) => voidRuns when the user flips it.

States

StateLooks like
onThe track turns primary.
focusedThe focus outline on the switch.
disabledThe switch and text dim.

Accessibility

roleswitch
nameThe label prop.
focusTab reaches it; Shift+Tab leaves it. A disabled one is skipped.
keyboardSpace flips it.
notesThe 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} />