Forms

Radio & RadioGroup

Native radios sharing a `name` already handle selection and arrow keys. RadioGroup adds the group semantics screen readers need, which v0 never provided.

data-scope="radio"

Usage

<RadioGroup name="size" label="Size">
  <Radio value="s" label="Small" />
  <Radio value="m" label="Medium" />
</RadioGroup>
<RadioGroup name="size" label="Size">
  <Radio value="s" label="Small" />
  <Radio value="m" label="Medium" />
</RadioGroup>
<RadioGroup name="size" label="Size">
  <Radio value="s" label="Small" bind:group={size} />
  <Radio value="m" label="Medium" bind:group={size} />
</RadioGroup>
<ck-radio-group label="Size">
  <ck-radio name="size" value="s" label="Small" [(selected)]="size" />
  <ck-radio name="size" value="m" label="Medium" [(selected)]="size" />
</ck-radio-group>

Props

PropTypeDefaultNotes
valuestringThis radio's value.
labelReactNodeLabel text.
size"sm" | "md" | "lg""md"Control size.
RadioGroup.invalidbooleanfalseMarks the group invalid. aria-invalid is not supported on role="radio", so it lives here, not on the individual radio.
RadioGroup.orientation"horizontal" | "vertical""horizontal"Layout axis.

Prop names are identical in all four frameworks. Only two-way binding differs, and each framework uses its own idiom over the same underlying prop.