Duolith docs

RadioGroup

Picks one of a few options, all shown at once, each with an optional hint.

Stability: experimental

Props

PropTypeDefaultMeans
labelstringThe group's accessible name.
options{ value: string; label: string; hint?: string }[]The choices.
valuestringbindable("")The chosen option's value. Bind it with bind:value={name}.
disabledbooleanfalseNo option can be chosen.

States

StateLooks like
chosenPrimary border, a tinted surface and a filled dot.
pressedThe option's background turns raised.
focusedThe focus outline on the option.
disabled50% opacity.

Accessibility

roleradiogroup, each option a radio with aria-checked
nameThe label prop; each option by its text.
focusOne Tab stop for the group: the chosen option, or the first option when none is chosen. The other options are left out of the Tab order.
keyboardArrowDown and ArrowRight move to the next option and choose it, ArrowUp and ArrowLeft to the previous one, wrapping at the ends and skipping disabled options. Enter or Space chooses the focused option.

Theme tokens

color.surface color.border color.primary color.raised color.muted color.ink space.3 radius.md radius.full text.body text.caption

Example

<RadioGroup label="Plan" options={plans} bind:value={plan} />