Forms & selection@neumorphism-ui/radio-group

Radio Group

Shares the name and selected state through React context while rendering every item as a real input[type=radio]. Supports controlled and uncontrolled values, horizontal or vertical layout, disabled, and required.

@neumorphism-ui/radio-group
Registry JSON

Preview

Installation

Installation: radio-groupnpx shadcn@latest add @neumorphism-ui/radio-group

The CLI resolves npm dependencies, base tokens, utilities, and component source in order.

New to this Registry? Set up the namespace before continuing.

Usage

Usage: Installationnpx shadcn@latest add @neumorphism-ui/radio-group @neumorphism-ui/label

Import

Radio Group import code
import {
  RadioGroup,
  RadioGroupItem,
} from "@/components/ui/radio-group"
import { Label } from "@/components/ui/label"

Example

Radio Group usage code
<RadioGroup
  defaultValue="comfortable"
  orientation="horizontal"
  aria-label="Display density"
>
  <Label className="flex gap-2" htmlFor="density-compact">
    <RadioGroupItem id="density-compact" value="compact" />
    Compact
  </Label>
  <Label className="flex gap-2" htmlFor="density-comfortable">
    <RadioGroupItem id="density-comfortable" value="comfortable" />
    Comfortable
  </Label>
</RadioGroup>

API Reference

ComponentPropTypeDefaultDescription
RadioGroupvalue / defaultValuestring—The controlled selected value or initial uncontrolled value.
RadioGrouponValueChange(value: string) => void—Called when the selected value changes.
RadioGrouporientation"horizontal" | "vertical""vertical"Sets the layout direction and aria-orientation.
RadioGroupnamestringgenerated idThe native radio name shared by all items.
RadioGroupdisabled / requiredbooleanfalseSets input constraints for all items.
RadioGroupItemvaluerequiredstring—The value passed to the group when the item is selected.

Accessibility

  • 01

    Give the RadioGroup root an accessible group name with aria-label or aria-labelledby.

  • 02

    Connect each RadioGroupItem id to Label htmlFor.

  • 03

    Real radio inputs preserve native form submission and keyboard selection behavior.