RadioGroup

Single selection from a list of mutually exclusive options

Setup

import { RadioGroup } from '@fragments-sdk/ui';

Examples

Default

Basic radio group with labels

Loading preview...

With Helper Text

Radio items with additional context

Loading preview...

Horizontal

Side-by-side layout

Loading preview...

With Group Helper Text

Group-level helper text

Loading preview...

With Error

Validation error state (string shows error message)

Loading preview...

Disabled

Non-interactive state

Loading preview...

Styling Targets

Use explicit class names for wrapper/group/item styling hooks

Loading preview...

Props

PropTypeDefaultDescription
valuestringNot setControlled selected value
defaultValuestringNot setDefault value (uncontrolled)
onValueChangefunctionNot setCallback when selection changes
onChangefunctionNot setAlias for onValueChange
orientationenumhorizontalverticalverticalLayout orientation
disabledbooleanfalseDisable all options
namestringNot setForm field name
labelstringNot setGroup label
helperTextstringNot setHelper text shown below the group
errorunionNot setShow error styling. When a string is provided, it is displayed as an error message.
sizeenumsmmdlgmdSize variant
wrapperClassNamestringNot setClass name for the outer wrapper element
groupClassNamestringNot setClass name for the inner radio group element
childrenRequirednodeNot setRadioGroup.Item elements

Usage Guidelines

When to use

  • User must select exactly one option from a small set
  • Options are mutually exclusive
  • All options should be visible at once
  • 2-5 options available

When not to use

  • Multiple selections allowed (use Checkbox group)
  • Many options (use Select)
  • Binary on/off choice (use Switch)
  • Options need to be searchable (use Combobox)

Best practices

  • Always have one option pre-selected when possible
  • Order options logically (alphabetical, frequency, etc.)
  • Keep option labels concise
  • Use helperText on RadioGroup.Item for complex options
Accessibility
  • Group must have an accessible label
  • Use arrow keys to navigate between options
  • Selected option should be clearly indicated