Radio Group
A set of checkable radio buttons where only one can be selected at a time. Built on Radix UI RadioGroup for keyboard navigation and accessibility.
Preview
Room Type
₹499/night
₹549/night
₹1,299/night
₹1,999/night
Usage
tsx
import { RadioGroup, RadioGroupItem } from "zostel-ui";
import { Label } from "zostel-ui";
<RadioGroup defaultValue="mixed-dorm" onValueChange={setValue}>
<div className="flex items-center gap-2">
<RadioGroupItem value="mixed-dorm" id="mixed" />
<Label htmlFor="mixed">Mixed Dorm</Label>
</div>
<div className="flex items-center gap-2">
<RadioGroupItem value="private-room" id="private" />
<Label htmlFor="private">Private Room</Label>
</div>
</RadioGroup>Props
| Prop | Type | Default | Description |
|---|---|---|---|
value | string | — | The controlled value of the selected radio item. |
defaultValue | string | — | The default value when uncontrolled. |
onValueChange | (value: string) => void | — | Called when the selected value changes. |
disabled | boolean | false | Disables all radio items in the group. |
orientation | "horizontal" | "vertical" | "vertical" | The orientation of the radio group for keyboard navigation. |
valueType:
stringDefault: —
The controlled value of the selected radio item.
defaultValueType:
stringDefault: —
The default value when uncontrolled.
onValueChangeType:
(value: string) => voidDefault: —
Called when the selected value changes.
disabledType:
booleanDefault: false
Disables all radio items in the group.
orientationType:
"horizontal" | "vertical"Default: "vertical"
The orientation of the radio group for keyboard navigation.