RadioGroup

Radio groups let people choose one option from a short visible set through options or RadioGroupItem composition.

Overview and decision boundary

Use RadioGroup when one choice must be selected from a short, visible set.

Do not use RadioGroup for large searchable sets; use Select or a future picker.

Preview

Visibility

Choose who can access this project.

Select the visibility that matches the project.

import { RadioGroup, RadioGroupItem } from '@nerio-ui/ui/client';<RadioGroup label="Visibility" name="visibility" defaultValue="team">  <RadioGroupItem value="private" description="Only you can access it.">Private</RadioGroupItem>  <RadioGroupItem value="team">Team</RadioGroupItem></RadioGroup>// Options API remains available for concise data-driven groups.<RadioGroup label="Visibility" options={[{ label: "Private", value: "private" }]} />

Installation and imports

Install the editable registry source, or use the matching package entrypoint when the product keeps Nerio as a workspace dependency.

pnpm dlx nerio add radio-groupimport { RadioGroup, RadioGroupItem } from '@nerio-ui/ui/client';

Usage

import { RadioGroup, RadioGroupItem } from '@nerio-ui/ui/client';<RadioGroup label="Visibility" name="visibility" defaultValue="team">  <RadioGroupItem value="private" description="Only you can access it.">Private</RadioGroupItem>  <RadioGroupItem value="team">Team</RadioGroupItem></RadioGroup>// Options API remains available for concise data-driven groups.<RadioGroup label="Visibility" options={[{ label: "Private", value: "private" }]} />

Variants

VariantUse
DefaultStacked radio options for small sets.
InvalidConnects group validation state and message.
DisabledPrevents changes for the group or an individual option.

Anatomy

SlotPurpose
rootField wrapper with label, description, group, and message.
labelVisible group label connected through aria-labelledby.
descriptionOptional group context connected through aria-describedby.
groupBase UI radiogroup that manages one selected value.
optionClickable option row with control and text.
controlBase UI radio control.
indicatorWhite selected-state dot on brand surface.
option-contentVisible option label and optional description.
option-labelVisible label content for one selectable option.
option-descriptionOptional supporting text for one selectable option.
messageOptional helper or validation message.

States

StateBehavior
CheckedOne option is selected.
DisabledThe whole group or individual options can be disabled.
Read-onlyThe selected option remains visible without accepting changes.
InvalidConnects validation message and invalid state.

Motion

  • State changes should use shared motion tokens and preserve reduced-motion behavior.

Accessibility

  • Uses Base UI Radio Group and Radio primitives for keyboard behavior.
  • Associates the visible group label with aria-labelledby.
  • Connects description and message text through aria-describedby.
  • Supports options and RadioGroupItem composition with one shared Base UI state model.
  • Supports disabled options, required, read-only, invalid, controlled, and uncontrolled values.
  • Validation messages use role="alert" only when invalid is true.

API

PropPurpose
value / defaultValue / onValueChangeControlled and uncontrolled value APIs for one selected option.
optionsConcise API for data-driven sets with label, value, description, and disabled.
children / RadioGroupItemComposition API for rich option content and explicit source control.
onValueChangeReceives value and Base UI event details; onChange remains compatible.
label / description / messageText slots wired to aria-labelledby and aria-describedby.
invalidSets invalid state on the group and message.

Implementation contract

ContractValue
Registry itemradio-group installs 5 Tailwind-first source files into the configured components directory.
Base UIradio-group, radio
Registry dependenciesform-message
Package dependencies@base-ui/react, clsx, react, tailwind-merge, tailwindcss

Styling contract

ContractValue
AuthoringComplete, statically detectable Tailwind CSS v4 recipes own component visuals.
ValuesSemantic and component --n-* variables remain the canonical customization layer.
OverridesCustomizable slots merge consumer className values with tailwindCn so conflicting utilities resolve deterministically.
Residual CSSOnly shared keyframes and scoped no-Preflight compatibility rules remain; there is no parallel visual selector layer.

Design notes

  • Use RadioGroup when one choice must be selected from a short, visible set.

Do / do not

Do

Use options for concise data-driven sets and RadioGroupItem composition for richer or conditional option content.

Do not

Use RadioGroup for large searchable sets; use Select or a future picker.

Tokens

These are the primary customization points. Override semantic or component tokens instead of changing component source.

TokenPurpose
--n-radio-sizePublic customization point for this component contract.
--n-radio-dot-sizePublic customization point for this component contract.
--n-radio-radiusPublic customization point for this component contract.
--n-input-borderPublic customization point for this component contract.
--n-input-border-hoverPublic customization point for this component contract.
--n-input-border-dangerPublic customization point for this component contract.
--n-color-action-primaryPublic customization point for this component contract.
--n-field-gapPublic customization point for this component contract.
--n-focus-ringPublic customization point for this component contract.