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 github:itsvigneshv/default-file-ui#main df-ui add radio-group

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.