Client component

Radio

Single-select options, managed by a group with automatic name wiring.

Selected plan: pro

Import#

import { Radio } from "astralis-ui";
// Radio.Group

Usage#

Always wrap radios in Radio.Group: it holds the selected value, shares one auto-generated name so the browser treats them as a set, and fires onChange(value) with the plain string.

Orientation, sizes and states#

Props#

PropTypeDefaultDescription
valuestring | numberNoneRequired; identifies the option.
size"sm" | "md" | "lg""md"Circle size.
colorSchemeall 15 schemes"brand"Selected hue.
invalid / disabled / readOnlybooleanfalseState flags, inherited from [Field](/docs/components/field).

Radio.Group#

PropTypeDefaultDescription
value / defaultValue / onValueChangestring / string / (value: string) => voidNoneControlled / uncontrolled selection. onChange still fires too, but is deprecated.
namestringgeneratedName shared by the radios in the set.
orientation"horizontal" | "vertical""vertical"Lays the radios out in a row or a column.
colorSchemeall 15 schemesNoneHue of every radio in the group; each can still override it.
disabledbooleanfalseDisables every radio in the group.

Keyboard#

KeyAction
TabInto the group: one tab stop (the selected option)
← ↑ / → ↓Move selection between options
SpaceSelect the focused option (when none is selected yet)

Accessibility#

The group renders role="radiogroup" over real <input type="radio"> elements: arrow-key movement between options is native browser behavior.