Radio Group

Exclusive native radio group with optional heading and per-item labels.

Also known as: radio buttons, option radios

Installation

Install with the CLI, or copy the component source into your project.

Add radio-group (npm)

npx --yes -p @default-file/ui df-ui add radio-group

Default

Group heading with per-item labels. One option is selected.

Visibility

Descriptions

Supporting text under the group heading and under each item label.

Plan
Choose the plan that matches how you work.

Orientation

Vertical stack by default. Horizontal wraps items in a row.

Vertical
Horizontal

Sizes

Group size sm and md. Items inherit the group size.

Small
Medium

Disabled

Disable the whole group, or disable a single item. Group disabled sets aria-disabled.

Region
Tier

Invalid

Invalid group chrome with aria-invalid on the radiogroup.

Visibility
Choose one option to continue.

Properties

Exclusive choice group built on native radios. Compose RadioGroup with RadioItem children.

RadioGroup

PropTypeDefaultNotes
valuestring | null-Controlled selected value.
defaultValuestring | nullnullUncontrolled initial value.
onValueChange(value: string) => void-Called with the newly selected value.
namestring-Shared native name for the radios. Generated when omitted.
labelReactNode-Group heading. Wired as aria-labelledby on the radiogroup.
descriptionReactNode-Supporting text under the heading. Wired as aria-describedby.
orientation"vertical" | "horizontal""vertical"Layout of the items.
size"sm" | "md""md"Default size for items.
disabledbooleanfalseDisables every item and sets aria-disabled on the group.
invalidbooleanfalseMarks the group invalid and sets aria-invalid.
childrenReactNode-RadioItem children.
classNamestring-Additional styles on the group root.

RadioItem

PropTypeDefaultNotes
valuestring-Item value (required).
labelReactNode-Visible label. When set (or description is set), wraps in a label element.
descriptionReactNode-Supporting text. Wired as aria-describedby on the radio input.
size"sm" | "md"-Override the group size for this item.
disabledboolean-Disable this item.
idstring-Input id. Generated when omitted.
classNamestring-Additional styles on the field wrapper when labeled, otherwise on the control root.

Accessibility

Group name (label or aria-label): Pass label for a visible group name, or aria-label / aria-labelledby on RadioGroup when there is no visible heading.