Radio Group

Accessible radio group on Base UI with keyboard navigation, a springy checked dot, larger hit areas, and invalid and disabled states. A shadcn-style drop in.

src/registry/ui/radio-group.tsx/r/radio-group.json

Installation#

bash
npx shadcn@latest add @minidev/radio-group

MiniDev UI is in the shadcn registry directory, so the short form works with no setup. Older CLI versions can use the full URL: npx shadcn@latest add https://ui.minidev.pro/r/radio-group.json

Usage#

tsx
import { RadioGroup } from "@/components/ui/radio-group"

export function Example() {
  return (
    <RadioGroup defaultValue="a" className="gap-2">
      <div className="flex items-center gap-2"><RadioGroupItem value="a" id="r1" /><Label htmlFor="r1">Alpha</Label></div>
      <div className="flex items-center gap-2"><RadioGroupItem value="b" id="r2" /><Label htmlFor="r2">Beta</Label></div>
      <div className="flex items-center gap-2"><RadioGroupItem value="c" id="r3" disabled /><Label htmlFor="r3">Disabled</Label></div>
    </RadioGroup>
  )
}

API reference#

Also accepts every prop of RadioGroupPrimitive props, passed through to the root element.

Dependencies#

npm

@base-ui/react

Built from

No other MiniDev files

Examples#

All form components

Learn more