Radio Group

A set of radio buttons where only one option can be selected.

Installation

Import the component from the passport-ui package.

components/example.tsx
1import { RadioGroup, RadioGroupItem } from "passport-ui";
2import { Label } from "passport-ui";

Usage

Basic example showing how to use the component.

components/example.tsx
1<div className="meta-container">
2 <Label htmlFor="radio">Choose an option</Label>
3 <RadioGroup defaultValue="option_2" id="radio">
4 <div className="flex items-center gap-2">
5 <RadioGroupItem value="option_1" id="option_1" />
6 <Label htmlFor="option_1" className="text-muted-foreground">
7 Option 1
8 </Label>
9 </div>
10 <div className="flex items-center gap-2">
11 <RadioGroupItem value="option_2" id="option_2" />
12 <Label htmlFor="option_2" className="text-muted-foreground">
13 Option 2
14 </Label>
15 </div>
16 <div className="flex items-center gap-2">
17 <RadioGroupItem value="option_3" id="option_3" />
18 <Label htmlFor="option_3" className="text-muted-foreground">
19 Option 3
20 </Label>
21 </div>
22 </RadioGroup>
23</div>

Additional resources

Documentation and examples are available in Storybook.