Skip to content

Radio Group

A set of options where exactly one is chosen. The arrow keys move between them and choose as they go, and Tab leaves the group. Pair each RadioGroupItem with a <label for> that names it. Built on the bits-ui RadioGroup.

Default

Exactly one option is chosen. The arrow keys move between options and choose as they go, so the group is a single tab stop. Point a <label for> at each item for its name.

Chosen: standard

Disabled option

A disabled item is skipped by the arrow keys and can't be chosen; the rest of the group still works.

API

RadioGroup

A set of options where exactly one is chosen. The arrow keys move between them and choose as they go, and Tab leaves the group. Pair each RadioGroupItem with a <label for> that names it. Built on the bits-ui RadioGroup.

Prop Type Default Description
children required import('svelte').Snippet

The items, each beside its label.

value bindable string ''

The chosen item's value. Two-way bindable via bind:value.

onValueChange (value: string) => void

Called when another item is chosen (forwarded via ...rest).

disabled boolean

Disables every item (forwarded via ...rest).

class string

Additional Tailwind classes merged onto the group.

RadioGroupItem

One option of a RadioGroup: a round button that shows a dot while it is the chosen one. Give it an id and point a <label for> at it for its name.

Prop Type Default Description
value required string

What the group's value becomes when this item is chosen.

id string

Lets a <label for> name the item (forwarded via ...rest).

disabled boolean

Disables the item (forwarded via ...rest).

class string

Additional Tailwind classes merged onto the item.