Skip to content
Porcelana

RadioGroup

Single choice from a short list, with roving focus and labelled items.

Example

Example.tsx
import { RadioGroup, RadioGroupItem } from "@porcelana/ui";

export default function Example() {
  return (
    <RadioGroup aria-label="Wake-up time" defaultValue="06:00">
      <RadioGroupItem value="05:30" label="05:30" />
      <RadioGroupItem value="06:00" label="06:00" />
      <RadioGroupItem value="07:15" label="07:15" />
    </RadioGroup>
  );
}

Import

Import
import { RadioGroup, RadioGroupItem } from "@porcelana/ui";
import "@porcelana/ui/styles.css"; // once, at your app root

Props

Generated from the TypeScript types. Standard HTML attributes are passed through and not listed.

RadioGroup

PropTypeDefaultDescription
aria-labelstring–Defines a string value that labels the current element. @see aria-labelledby.
asChildboolean–Render the single child element instead, merging props and behaviour onto it.
defaultValuestring–Initial value when uncontrolled.
dirDirection–Reading direction for keyboard navigation ("ltr" or "rtl").
disabledboolean–Prevents interaction and dims the control.
formstring–Id of the form this control belongs to.
idstring–Element id. Generated automatically when omitted.
loopboolean–Whether keyboard navigation wraps from the last item to the first.
namestring–Field name submitted with a form.
onValueChange((value: string) => void)–Called with the new value.
orientationOrientation–Layout and arrow-key direction.
requiredboolean–Marks the control as required in forms.
valuestring | null–Controlled value. Use with onValueChange.

RadioGroupItem

PropTypeDefaultDescription
labelrequiredReactNode–Visible label; the whole row is the touch target.
aria-labelstring–Defines a string value that labels the current element. @see aria-labelledby.
asChildboolean–Render the single child element instead, merging props and behaviour onto it.
checkedboolean–Controlled checked state. Use with onCheckedChange.
disabledboolean–Prevents interaction and dims the control.
idstring–Element id. Generated automatically when omitted.
requiredboolean–Marks the control as required in forms.
type"button" | "submit" | "reset"–Button type (defaults to "button").
valuestring | null–Controlled value. Use with onValueChange.

Accessibility

  • Tab enters the group once; arrow keys move between options and Space selects.
  • Give the group an aria-label or wrap it in a labelled fieldset.

Mobile

  • Each option row is at least 44px tall.
  • Set orientation="horizontal" for a wrapping row.