Skip to content
Logic2BUI

Search docs

Search components and documentation

New
Menu

Radio Group

A set of checkable buttons where no more than one can be checked at a time.

Installation

npx logic2b@latest add radio-group

Usage

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

<RadioGroup defaultValue="comfortable">
  <RadioGroupItem value="default" id="r1" />
  <RadioGroupItem value="comfortable" id="r2" />
</RadioGroup>

API

Prop Type Default
value / defaultValue (RadioGroup) string
onValueChange (RadioGroup) (value: string) => void
orientation (RadioGroup) horizontal | vertical vertical
disabled (RadioGroup) boolean false
value (RadioGroupItem) string — required
disabled (RadioGroupItem) boolean false

Examples

Cards

With a disabled option

Accessibility

Built on Radix Radio Group, following the WAI-ARIA radiogroup pattern.

  • Arrow keys move between and select options; only one item is checked at a time.
  • The group is reachable with Tab; focus lands on the checked item (or the first item if none is selected).
  • Pair each RadioGroupItem with a Label via matching id/htmlFor so the hit target and screen-reader name are correct.