Skip to Content
NarakUI

Radio Group

A set of mutually exclusive options where only one can be selected at a time.

Default

Vertical by default. Control it with value and onValueChange, or let it manage itself with defaultValue. Name the group with aria-label or aria-labelledby so screen readers announce what the choice is for.

Horizontal

Disabled

Disable a single item, or the whole group with disabled on RadioGroup.

Read only

Keeps the selected appearance but ignores clicks and keyboard focus.

Installation

pnpm dlx shadcn@latest add @narakui/radio-group

Add "@narakui": "https://ui.narakcode.dev/r/{name}.json" to components.json, or install directly from https://ui.narakcode.dev/r/radio-group.json.

Usage

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

<RadioGroup aria-label="Report frequency" defaultValue="weekly">
  <RadioGroupItem value="daily">Daily</RadioGroupItem>
  <RadioGroupItem value="weekly">Weekly</RadioGroupItem>
  <RadioGroupItem value="monthly">Monthly</RadioGroupItem>
</RadioGroup>

RadioGroup Properties

PropTypeDefaultDescription
valuestring—Controlled selected value.
defaultValuestring—Initial selected value when uncontrolled.
onValueChange(value: string) => void—Called when the selected value changes.
orientation'horizontal' | 'vertical''vertical'Layout direction of the items.
disabledbooleanfalseDisables every item.
classNamestring—Additional classes for the group.

RadioGroupItem Properties

PropTypeDefaultDescription
valuestring (required)—Value submitted when this item is selected.
childrenReactNode—Label rendered next to the radio control.
disabledbooleanfalseDisables this item.
readOnlybooleanfalsePrevents interaction while keeping the current appearance.
selectedIconReactNode—Replaces the default dot shown in the selected state.
disableHoverbooleanfalseRemoves all hover feedback.
disablePaddingbooleanfalseRemoves the row padding. Hover then darkens the empty radio's border instead of filling a background.
classNamestring—Additional classes for the row.
radioClassNamestring—Additional classes for the radio control.
childrenWrapperClassNamestring—Additional classes for the element that wraps the label.