Skip to content

Radio

A form control for selecting one option from a mutually exclusive set.

Preview

States

Error state

Please select an option.

States

StateAppearance
UnselectedEmpty circle with border
SelectedBrand-purple inner dot
Disabled60% opacity, no interaction
Focus2 px brand-purple ring with 2 px offset
ErrorRed border

Props

PropTypeDefaultDescription
valuestring--Value for the radio option
checkedbooleanfalseWhether this option is selected
onChange(value: string) => void--Change handler
labelstring--Visible label text
namestring--Group name (shared by related radios)
disabledbooleanfalseDisables interaction
errorbooleanfalseShows error border

Code example

React

tsx
import { RadioGroup, Radio } from '@thepace/lexicon/components';

<RadioGroup name="plan" value={plan} onChange={setPlan}>
  <Radio value="free" label="Free plan" />
  <Radio value="pro" label="Pro plan" />
  <Radio value="enterprise" label="Enterprise plan" />
</RadioGroup>

Vanilla HTML

html
<div class="lex-radio-group" role="radiogroup" aria-label="Plan">
  <label class="lex-radio">
    <input type="radio" name="plan" class="lex-radio__input" value="free" checked />
    <span>Free plan</span>
  </label>
  <label class="lex-radio">
    <input type="radio" name="plan" class="lex-radio__input" value="pro" />
    <span>Pro plan</span>
  </label>
</div>

CSS class reference

ClassPurpose
.lex-radioWrapper label
.lex-radio__inputThe radio input
.lex-radio--disabledDisabled state
.lex-radio--errorError border
.lex-radio-groupVertical group container

Accessibility

  • Uses native <input type="radio"> for built-in keyboard and screen reader support.
  • Group radios with a shared name attribute and wrap in role="radiogroup" with aria-label.
  • Arrow keys navigate within the group; Space/Enter selects.
  • aria-invalid="true" when in error state.

Guidelines

Do

  • Use for mutually exclusive choices where all options should be visible.
  • Wrap related radios in a <fieldset> with a <legend>.
  • Pre-select a default option when one makes sense.

Don't

  • Don't use for multiple selections — use Checkbox instead.
  • Don't use for more than 7 options — consider a Select dropdown.

Released under the MIT License. A product by the pace.