RadioGroup
Picks one of a few options, all shown at once, each with an optional hint.
Stability: experimental
Props
| Prop | Type | Default | Means |
|---|---|---|---|
label | string | The group's accessible name. | |
options | { value: string; label: string; hint?: string }[] | The choices. | |
value | string | bindable("") | The chosen option's value. Bind it with bind:value={name}. |
disabled | boolean | false | No option can be chosen. |
States
| State | Looks like |
|---|---|
chosen | Primary border, a tinted surface and a filled dot. |
pressed | The option's background turns raised. |
focused | The focus outline on the option. |
disabled | 50% opacity. |
Accessibility
| role | radiogroup, each option a radio with aria-checked |
| name | The label prop; each option by its text. |
| focus | One 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. |
| keyboard | ArrowDown 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} />