Componentform1 KB gzipZero dependencies

Radio Group

Accessible single-select radio button set.

Preview

Live Preview
Open ↗

Installation

Tokens guide →

Add to your project via CLI (zero dependencies, code you own):

npx bigbullui add radio-group

Or install the full npm package:

npm install bigbullui

Usage

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 helpers

Zero 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 />
PropTypeDescription
valuestringControlled selected value.
defaultValuestringUncontrolled initial value.
onValueChange(value: string) => voidCalled when selection changes.
namestringNative radio group name (required).
disabledbooleanDisables interaction and applies disabled styling.
requiredbooleanMarks the input as required for native form validation.
orientation"vertical" | "horizontal"Layout and keyboard navigation axis. (Default: "vertical")
dirDirectionExplicit reading direction override (ltr or rtl).
classNamestringOptional Tailwind or custom CSS classes merged with component styles.
childrenReact.ReactNodeChild elements rendered inside the component.