Radio
A radio input component for selecting a single option from a set, with support for both standalone and group usage.
Import
Usage
Examples
Variant
Orientation
Controlled
Selected: option1
Default value
Standalone radio (without group)
With description on individual radios
Inheritance
Radio and RadioGroup share common foundational props with <Input />, including:
size,radius,variant,colorlabel,labelAlign,description,messagestatus,required,disabledclassName
Reference: For a complete list of inherited props with detailed descriptions, see the Input documentation.
What Radio adds
Radio extends Input with the following additional features:
| Feature | Description |
|---|---|
| Group Management | RadioGroup manages shared state across multiple Radio components |
| Selection State | Controlled and uncontrolled selection handling |
| Card Variant | Radio rendered as a card-style container for enhanced visual selection |
| Individual Descriptions | Each radio can have its own description text |
| Orientation | Horizontal or vertical layout for the group |
What Radio modifies
| Modification | Description |
|---|---|
value | Replaced with string values for radio selection |
onChange | Receives the selected value instead of an event |
type | Not applicable - Radio uses native radio inputs |
placeholder | Not applicable |
What Radio does not inherit
The following Input props are not available on Radio/RadioGroup:
| Prop | Reason |
|---|---|
placeholder | Not applicable for radio inputs |
startContent | Not applicable - no input adornments |
endContent | Not applicable - no input adornments |
isLoading | Not applicable - no loading state |
inputMode | Not applicable |
All other Input props are fully supported. See the Input documentation for the complete list.
RadioGroup Props
| Prop | Type | Default | Description |
|---|---|---|---|
children | ReactNode | None | Radio components (required) |
name | string | Auto-generated | Name attribute for radio inputs |
value | string | None | Controlled selected value |
defaultValue | string | None | Default selected value |
onChange | (value: string) => void | None | Callback when selection changes |
size | "sm" | "md" | "lg" | "md"* | Size scale |
color | "none" | "default" | "primary" | "secondary" | "danger" | "warning" | "success" | "primary"* | Semantic color |
variant | "default" | "card" | "default"* | Visual style |
orientation | "horizontal" | "vertical" | "vertical" | Layout direction |
status | "default" | "error" | "success" | "warning" | "default" | Validation status |
label | string | None | Group label |
labelAlign | "left" | "top" | "left"* | Label position |
description | string | None | Help text below the group |
message | string | None | Status message |
required | boolean | false | Shows required indicator |
disabled | boolean | false | Disables all radios |
className | string | None | Extra classes |
Radio Props
| Prop | Type | Default | Description |
|---|---|---|---|
value | string | None | Radio value (required) |
label | ReactNode | None | Radio label |
description | ReactNode | None | Optional description text |
size | "sm" | "md" | "lg" | Inherits from group | Size scale |
color | "none" | "default" | "primary" | "secondary" | "danger" | "warning" | "success" | Inherits from group | Semantic color |
radius | "none" | "xs" | "sm" | "md" | "lg" | "xl" | "full" | "full"* | Corner rounding |
variant | "default" | "card" | Inherits from group | Visual style |
status | "default" | "error" | "success" | "warning" | Inherits from group | Validation status |
checked | boolean | None | Controlled checked state |
defaultChecked | boolean | false | Default checked state |
onChange | (checked: boolean, value: string, event: ChangeEvent) => void | None | Callback when radio changes |
disabled | boolean | Inherits from group | Disables the radio |
className | string | None | Extra classes |
* Falls back through Global Configuration if not set. See below.
Global Configuration
Radio and RadioGroup read defaults from four places, in this order of precedence:
- Instance prop: set directly on
<Radio />or<RadioGroup /> - Component config:
components.radioin yourashee.config - Theme default:
defaultColor/defaultRadiusin yourashee.config - Built-in fallback: component's internal default values
Component config
Built-in fallbacks
Accessibility
- Renders native
<input type="radio">elements with proper semantics - Group uses
role="radiogroup" - Labels are associated with inputs via
htmlFor/id - Supports keyboard navigation with arrow keys
- Implements
focus-visiblerings for keyboard navigation - Uses
aria-invalidfor error states - Uses
aria-disabledfor disabled states - Card variant maintains proper focus indicators
Notes
- Group Context: Radio components inherit properties (size, color, variant, disabled, status) from their parent RadioGroup.
- Card Variant: The
cardvariant wraps each radio option in a bordered container that highlights when selected. - Controlled vs Uncontrolled: Use
value/onChangeon RadioGroup for controlled usage, ordefaultValuefor uncontrolled. - Standalone Usage: Radio can be used without a RadioGroup by providing
nameand handling state manually. - Radius: When using
variant="card", thefullradius is automatically mapped toxlfor proper visual appearance. - Individual Descriptions: Each radio can have its own description text, useful for explaining different options.
- Orientation: RadioGroup supports horizontal and vertical layouts for flexible design.
- Inheritance: Radio and RadioGroup share common props with Input but omit input-specific adornments.