Mushilu-San UI

Search components

PlaygroundStorybookGitHub
Forms

Radio

A native radio button for choosing exactly one option from a set.

Selector: input[type=radio][muiRadio]

Import
import { Radio } from '@mushilu-san/ui/forms';
PreviewCode

Loading example…

Overview

Radio is applied to a native <input type="radio">. Radios that share a name form one group: only one can be checked, and the arrow keys move between them.

Put the group in a <fieldset> with a <legend> so screen readers announce the question with each option.

When to use

  • Choosing one option from a short list, where all options should be visible.
  • Choosing between two to five options that each need an explanation.

When not to use

  • Choosing one option from a long list. Use a select.
  • Choosing several options. Use checkboxes. Use Checkbox instead.

Examples

Sizes

PreviewCode

Loading example…

Guidelines

Do

  • Put a question in the legend of the fieldset.
  • Pre-select a sensible default when there is one.

Don't

  • Do not use a radio group with only one option.
  • Do not use radios for a yes/no choice that needs to be remembered. Use a toggle or checkbox.

Accessibility

Roles and attributes

ElementRoleNotes
input[type=radio]radio (native)

Keyboard

KeysAction
TabShiftTabMoves focus into the group on the checked radio, then out of it.
Arrow keysMove the selection to the next or previous radio in the group.
SpaceChecks the focused radio.
  • Each radio needs a visible label. Group radios with name and a fieldset.

API

Radio

Selector: input[type=radio][muiRadio]

NameTypeDefaultDescription
size'sm' | 'md' | 'lg''md' Radio size: `sm`, `md` or `lg`. Default `md`.

CSS parts

  • ::part(radio)

Tokens

  • --mui-color-primary
  • --mui-color-border
  • --mui-color-focus-ring
  • --mui-touch-target