Skip to content

Radio Group

Size

A single-select radio group built on native <input type="radio"> items — the browser provides roving tabindex, arrow navigation and form participation.

<script>
import RadioGroup from "@invisible-ui/svelte/RadioGroup.svelte";
</script>
PropTypeDefaultDescription
items *RadioGroupItem[]—
valuestring | nullnull
disabledbooleanfalse
orientationOrientation"vertical"Layout direction.
label *string—Accessible name for the group.
namestring | undefinedundefinedForm field name — the selected value is submitted under it (auto-generated for grouping if omitted).
onValueChange((value: string) => void) | undefinedundefinedCalled whenever the selected value changes.
  • Native radio pattern: the browser handles roving tabindex, arrow/Home/End navigation, selection-follows-focus and form submission.
  • role="radiogroup" with an accessible label; each item exposes data-state for styling.
<RadioGroup
label="Plan"
value="pro"
items={[
{ value: "free", label: "Free" },
{ value: "pro", label: "Pro" },
]}
onValueChange={(v) => (plan = v)}
/>

In React, value works controlled or uncontrolled. onValueChange reports what the user chooses; a changed value reports nothing:

<RadioGroup
label="Plan"
value={plan}
items={[
{ value: "free", label: "Free" },
{ value: "pro", label: "Pro" },
]}
onValueChange={setPlan}
/>

Themeable via --ds-radio-*.