Menu

Radio

Single-select control. 2 values × 4 states.

Installation

$ npx uix-ui@latest add radio

This copies the file into components/ui/radio.tsx in your project. npx shadcn@latest add @uix/radio works too.

Usage

radio.tsx
import { Radio } from "@/components/ui/radio";

<div role="radiogroup" aria-label="Payment" style={{ display: "grid", gap: 12 }}>
  <Radio name="pay" label="bKash" defaultChecked />
  <Radio name="pay" label="Cash on delivery" />
  <Radio name="pay" label="Card (coming soon)" disabled />
</div>

Examples

Default choice and disabled

Props

PropTypeDefaultDescription
labelReact.ReactNode–

Everything else is passed to the root element, so className, aria-* and event handlers work as usual.

Dependencies

Installed for you by the CLI.

  • class-variance-authority
  • clsx
  • tailwind-merge
  • lib/utils.ts
esc

↑↓ to navigate · ↵ to select · esc to close