EXEPERTAI LAB

Research alpha

Time Machine
EXEPERTAI LAB
GALLERY / COLLECTION
← Browse Astryx gallery
Radio·component·@astryxdesign/core

Radio List

Radio group container with field integration for label, description, and status.

Open in Playground @astryxdesign/core/RadioList

Showcases and examples

5 documented examples

Radio List

RadioList API entry

Preview loads on approachPreview loads on approach
Exact source · radio-list-showcase
// Copyright (c) Meta Platforms, Inc. and affiliates.

'use client';

import {useState} from 'react';
import {RadioList, RadioListItem} from '@astryxdesign/core/RadioList';

export default function RadioListShowcase() {
  const [value, setValue] = useState('');
  return (
    <RadioList
      label="Notification preference"
      value={value}
      onChange={setValue}>
      <RadioListItem label="Email" value="email" />
      <RadioListItem label="SMS" value="sms" />
      <RadioListItem label="Push notification" value="push" />
    </RadioList>
  );
}

Usage

A group of options where only one can be selected at a time. All options are visible at once, making it easy to compare choices. Use it when users need to pick one option from a small set.

  • Keep the number of options small: typically 2 to 7 choices.
  • Use clear, concise labels that differentiate each option at a glance.
  • Pre-select a default option when there's a sensible default; don't leave the group empty unless the choice is optional.
  • Use when multiple selections are needed; use CheckboxList instead.
  • Use for long lists; use Selector for better discoverability.
  • Use horizontal layout with more than 4 options; it wraps awkwardly.
  • Wrap a disabled RadioList in Tooltip to explain why it is disabled; disabled controls swallow the hover events the wrapper needs. Use the disabledMessage prop instead.

Typed props

PropType and behavior
labelstring · required
Label text for the radio group (always rendered for accessibility).
valuestring · required
The currently selected value.
onChange(value: string) => void · required
Callback fired when the selected value changes.
childrenReactNode · required
RadioListItem elements.
isLabelHiddenboolean · default false
Whether to visually hide the label.
descriptionstring
Description text displayed below the label.
orientation'vertical' | 'horizontal' · default 'vertical'
Layout direction of the radio items.
isDisabledboolean · default false
Whether all radio items are disabled.
htmlNamestring
The HTML name attribute shared by the radio inputs, useful for form submissions. When omitted, a unique internal name still groups the radios.
disabledMessagestring
Explains why the group is disabled. Applies to the whole-group disabled state (isDisabled), not per item. With isDisabled, shows a tooltip on hover/keyboard focus and keeps the radios focusable via aria-disabled (selection stays blocked). Use this instead of wrapping a disabled RadioList in Tooltip. Disabled controls swallow the hover events an external Tooltip needs.
isRequiredboolean · default false
Whether the radio group is required.
isOptionalboolean · default false
Whether the field is optional (mutually exclusive with isRequired).
status{type: 'warning' | 'error' | 'success', message?: string}
Status indicator ({ type, message }).
size'sm' | 'md' · default 'md'
Size of the radio controls.
labelTooltipstring
Tooltip text for an info icon next to the label.
widthSizeValue
Width of the field (number = pixels, string used as-is, e.g. "100%"). Sizes the whole field (label, control, and status) so they stay aligned.
xstyleStyleXStyles
StyleX styles for layout customization (margins, positioning, sizing). Must be a stylex.create() value: not an inline style object like style={{}}.

Anatomy

Header · optional

Optional heading above the radio list.

Children · required

The radio list items rendered as selectable options.

Label/Value · required

The text label and associated value for each radio item.

Accessibility

Radio circle

Color contrast · 1.4.11 Non-text Contrast · 3:1

The circle edge (unselected) and fill (selected) must have at least 3:1 contrast with the surface behind them. For Hover and Pointer down, measure the final colors after the tint and the pressed overlay are applied.

States: Rest, Hover, Pointer down, Selected

Theming

Targets

astryx-radio-list

Visual props: orientation, size

astryx-radio-list-item

Visual props: size

States: selected, disabled

astryx-radio-indicator

Visual props: size

States: checked, disabled

astryx-radio-indicator-dot

Visual props: size

astryx-radio

Visual props: size

States: checked, disabled

Deprecated; use radio-indicator.

astryx-radio-dot

Visual props: size

Deprecated; use radio-indicator-dot.