structyl

Radio Group

stable

A set of checkable buttons where only one can be checked at a time.

Basic usage

Examples

Density selector

Three options with descriptive labels for choosing UI density.

Card radio choices

Use radio items inside larger labels when the option needs supporting copy.

Semantic colors

Color prop on RadioGroup.Item sets the checked-state indicator color.

Features

  • Roving focus.
  • Controlled or uncontrolled.

Installation

bash
pnpm dlx structyl add radio-group

API Reference

RadioGroup.Root

Groups radio items; manages selection and roving focus.

PropTypeDefault
valuestring

Controlled selected value.

defaultValuestring

Initial value when uncontrolled.

onValueChange(value: string) => void

Called when the selection changes.

disabledboolean

Disable the whole group.

false
orientation'horizontal' | 'vertical'

Arrow-key navigation axis.

'vertical'
loopboolean

Whether arrow navigation wraps.

true
namestring

Name for form submission.

RadioGroup.Item

An individual radio button.

PropTypeDefault
valuestring

The value submitted when selected.

disabledboolean

Disable this item.

false
Radio Group | structyl