Command Palette

Search for a command to run...

Radio Group

shadcn/ui

A set of checkable buttons—known as radio buttons—where no more than one of the buttons can be checked at a time.

import { RadioGroup, RadioGroupItem } from "@/registry/optics/radio-group";import { Label } from "@/registry/optics/label";<RadioGroup defaultValue="comfortable">	<div className="flex items-center space-x-2">		<RadioGroupItem value="default" id="r1" />		<Label htmlFor="r1">Default</Label>	</div>	<div className="flex items-center space-x-2">		<RadioGroupItem value="comfortable" id="r2" />		<Label htmlFor="r2">Comfortable</Label>	</div>	<div className="flex items-center space-x-2">		<RadioGroupItem value="compact" id="r3" />		<Label htmlFor="r3">Compact</Label>	</div></RadioGroup>

Installation

pnpm dlx shadcn@latest add https://optics.agusmayol.com.ar/r/radio-group.json

Props

<RadioGroup />
Name
Type
className
string
value
string
defaultValue
string
onValueChange
(value: string) => void
disabled
boolean
name
string
required
boolean
orientation
"horizontal" | "vertical"
dir
"ltr" | "rtl"

<RadioGroupItem />
Name
Type
className
string
value
string (required)
disabled
boolean
required
boolean