Usage
To display a radio group, list two or more RadioGroupItem
s within RadioGroup
.
Dark mode
To display radios on a dark background, pass theme="dark"
.
Orientation
Display radio buttons horizontally by passing orientation="horizontal"
.
Disabled
The entire group can be disabled by using the disabled
prop.
The disabled
prop can also be used to disable a specific RadioGroupItem
.
Controlled state
By default, <RadioGroup>
is uncontrolled, meaning it manages its own state locally. To make it controlled, set value
and onValueChange
.
API Reference
RadioGroup
Contains all the parts of a radio group.
Inherits properties from HTMLElement
.
Prop | Type | Default |
---|---|---|
asChild | boolean | false |
children | ReactNode | |
defaultValue | string | |
dir | "ltr" "rtl" | |
disabled | boolean | |
label | string | |
loop | boolean | true |
onValueChange | (value: string) => void | |
orientation | "horizontal" "vertical" | "vertical" |
required | boolean | |
theme | "light" "dark" | "light" |
value | string |
RadioGroupItem
An item in the group that can be checked. An input
will also render when used within a form
to ensure events propagate correctly.
Inherits properties from HTMLButtonElement
.
Prop | Type | Default |
---|---|---|
asChild | boolean | false |
children | ReactNode | |
defaultValue | string | |
disabled | boolean | |
label | string | |
loop | boolean | true |
orientation | "horizontal" "vertical" | "vertical" |
required | boolean | |
theme | "light" "dark" | "light" |
value | string |