Componentform1 KB gzipZero dependencies
Radio Group
Accessible single-select radio button set.
Preview
Live Preview
Installation
Tokens guide →Add to your project via CLI (zero dependencies, code you own):
npx bigbullui add radio-groupOr install the full npm package:
npm install bigbulluiUsage
tsx6 lines
import { RadioGroup, RadioItem } from "@/components/ui/radio-group"; <RadioGroup name="seat" defaultValue="window"> <RadioItem value="window">Window</RadioItem> <RadioItem value="aisle">Aisle</RadioItem></RadioGroup>Source code
radio-group.tsx + 3 helpersZero third-party dependencies (4 local files shown in tabs below).
tsxradio-group.tsx179 lines
"use client"; import * as React from "react";import { cn } from "./lib/utils";import { mergeRefs } from "./lib/react-compat";import type { Direction } from "./lib/direction"; interface RadioGroupContextValue { value: string; name: string; disabled?: boolean; required?: boolean; onSelect: (val: string) => void;} const RadioGroupCtx = React.createContext<RadioGroupContextValue | null>(null); export type RadioGroupProps = React.HTMLAttributes<HTMLDivElement> & {Props
Interactive Prop Playground
Tweak parsed AST props below to generate ready-to-paste JSX.
tsx3 lines
import { RadioGroup } from "@/components/ui/radio-group"; <RadioGroup />| Prop | Type | Description |
|---|---|---|
| value | string | Controlled selected value. |
| defaultValue | string | Uncontrolled initial value. |
| onValueChange | (value: string) => void | Called when selection changes. |
| name | string | Native radio group name (required). |
| disabled | boolean | Disables interaction and applies disabled styling. |
| required | boolean | Marks the input as required for native form validation. |
| orientation | "vertical" | "horizontal" | Layout and keyboard navigation axis. (Default: "vertical") |
| dir | Direction | Explicit reading direction override (ltr or rtl). |
| className | string | Optional Tailwind or custom CSS classes merged with component styles. |
| children | React.ReactNode | Child elements rendered inside the component. |