1 import { Label, RadioGroup } from "@medusajs/ui"
2 import * as React from "react"
3
4 export default function RadioGroupControlled() {
5 const [value, setValue] = React.useState("1")
6 return (
7 <div className="flex flex-col gap-2 items-center">
8 <RadioGroup value={value} onValueChange={setValue}>
9 <div className="flex items-center gap-x-3">
10 <RadioGroup.Item value="1" id="radio_1_controlled" />
11 <Label htmlFor="radio_1_controlled" weight="plus">
12 Radio 1
13 </Label>
14 </div>
15 <div className="flex items-center gap-x-3">
16 <RadioGroup.Item value="2" id="radio_2_controlled" />
17 <Label htmlFor="radio_2_controlled" weight="plus">
18 Radio 2
19 </Label>
20 </div>
21 <div className="flex items-center gap-x-3">
22 <RadioGroup.Item value="3" id="radio_3_controlled" />
23 <Label htmlFor="radio_3_controlled" weight="plus">
24 Radio 3
25 </Label>
26 </div>
27 </RadioGroup>
28 <div className="txt-small text-ui-fg-muted">Selected value: {value}</div>
29 </div>
30 )
31 }