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.

Radio Group

import { RadioGroup, RadioGroupItem } from "@/components/optics/radio-group";import { Label } from "@/components/optics/label";<div className="w-full flex flex-col items-center justify-center gap-4">  <div className="flex flex-col items-start gap-4">    <RadioGroup      className="flex flex-col items-start justify-start"      defaultValue="comfortable"    >      <div className="flex items-center justify-start gap-2">        <RadioGroupItem          id="r1"          value="default"        />        <Label htmlFor="r1">          Default        </Label>      </div>      <div className="flex items-center justify-start gap-2">        <RadioGroupItem          id="r2"          value="comfortable"        />        <Label htmlFor="r2">          Comfortable        </Label>      </div>      <div className="flex items-center justify-start gap-2">        <RadioGroupItem          id="r3"          value="compact"        />        <Label htmlFor="r3">          Compact        </Label>      </div>    </RadioGroup>  </div></div>

Installation

pnpm dlx shadcn@latest add @optics/radio-group

Props

<RadioGroup />
Name
Type
inputRef
React.Ref<HTMLInputElement>
nativeButton
boolean
render
React.ReactElement
keepMounted
boolean
onValueChange
(...args) => void

<RadioGroupItem />
Name
Type
inputRef
React.Ref<HTMLInputElement>
nativeButton
boolean
render
React.ReactElement
keepMounted
boolean
onValueChange
(...args) => void