Radio Group
A set of checkable buttons—known as radio buttons—where no more than one of the buttons can be checked at a time.
Features
- Full keyboard navigation.
- Can be controlled or uncontrolled.
Install the component from your command line.
Import the components and piece the parts together.
Create your styled radio group component from the primitive parts.
Contains all the parts of a radio group.
Prop | Type | Default | Required |
---|---|---|---|
as | enum | div | |
defaultValue | string | ||
value | string | ||
onValueChange | function | ||
required | boolean |
An item in the group that can be checked.
Prop | Type | Default | Required |
---|---|---|---|
as | enum | button | |
name | string | ||
value | string | ||
onCheckedChange | function | ||
disabled | boolean | ||
required | boolean | ||
readOnly | boolean |
Renders when the radio item is in a checked state. You can style this element directly, or you can use it as a wrapper to put an icon into, or both.
Prop | Type | Default | Required |
---|---|---|---|
as | enum | span | |
forceMount | boolean |
Adheres to the Radio Group WAI-ARIA design pattern and uses roving tabindex to manage focus movement among radio items.
Key | Description |
---|---|
Tab | Moves focus to either the checked radio item or the first radio item in the group. |
Space | When focus is on an unchecked radio item, checks it. |
Enter | When focus is on an unchecked radio item, checks it. |
ArrowDown | Moves focus to the next radio item in the group. |
ArrowRight | Moves focus to the next radio item in the group. |
ArrowUp | Moves focus to the previous radio item in the group. |
ArrowLeft | Moves focus to the previous radio item in the group. |