Radio

Selects exactly one option from a small set that stays visible.

Configurations

Supported configurations for this component.

States

Interaction states covered by the API and the style contract.

Configurations

3 examples
Off
md
lg
On
md
lg
With description
Runs on the schedule you set, without asking again.
md
Runs on the schedule you set, without asking again.
lg

States

7 examples
Hover
Rest
Hover
Focus visible
Rest
Focus visible
Disabled
On hover
Rest
On hover
Pressed
Rest
Pressed
Disabled on
Disabled group

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/••••••••••••

Light and dark both come with the install and follow the dark class on <html>, the shadcn dark mode setup (next-themes with attribute="class").

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.
descriptionReact.ReactNode-Helper line under the label; the box aligns to the first line and the input is described by it.
size'md'|'lg''md'Two rungs, 16 and 20px boxes, scaling the box, its mark and the label together, matching Checkbox at the same value. There is no 12px `sm` rung.
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 Pro components