Radio

Mutually-exclusive square radio. Standalone or inside a RadioGroup wiring up name, value, onValueChange.

Group
Standalone

Add to your project

One command adds this component to your project.

1

Run the following command. New project? Run npx shadcn@latest init first to set up Tailwind and path aliases.

npx shadcn@latest add @aicanvas/andromeda-radio

Props

Every prop this component accepts. Any other prop is forwarded to the underlying element.

RadioGroup

PropTypeDefaultDescription
namestring-Shared group name for the radios' native inputs; auto-generated when omitted.
valuestring-Selected value in controlled mode; the matching radio is checked.
defaultValuestring-Initially selected value when uncontrolled.
onValueChange(next: string) => void-Handler called with the newly selected value.
disabledbooleanfalseDisables every radio in the group.
childrenReact.ReactNode-Radio elements belonging to the group.
classNamestring-Extra classes for the group wrapper.
styleReact.CSSProperties-Inline styles merged onto the group wrapper.

Radio

PropTypeDefaultDescription
valuestring-Required when used inside RadioGroup.
checkedboolean-Standalone controlled state.
defaultCheckedbooleanfalseInitial checked state when uncontrolled and standalone.
onCheckedChange(next: boolean) => void-Handler called with the new checked state when toggled.
labelstring-Text label rendered beside the box.
disabledboolean-Disables the radio and blocks interaction.
classNamestring-Extra classes merged onto the visual box.
styleReact.CSSProperties-Inline styles merged onto the wrapper.
idstring-Id for the input; links the label via htmlFor, auto-generated when omitted.
namestring-Native input name that groups radios; falls back to the group's name.

More Andromeda components