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#
Related forms components#
AutocompleteText input that filters string options as you type, using ARIA combobox and listbox roles. Works controlled or uncontrolled and lists up to eight matches.Calendar MonthMonth calendar grid with weekday headers and clickable day cells that highlight the selected date. A simple Tailwind base for date views and schedulers.Character CountLive React character counter that shows the current count against a limit and turns red when it goes over. Announces changes politely to screen readers.Checkbox GroupVertical wrapper that groups related checkboxes under role group with even spacing. Use it with Checkbox and labels for multi select settings.CheckboxShadcn style checkbox on Base UI with an animated check, indeterminate state, invalid and disabled styles, and an enlarged hit area for touch.Chip FilterSingle select filter chips in React that behave as a radio group, with an accent ring on the active chip. Good for quick filters above lists and tables.
All form components