Radio

Material Design 3 radio button component with multiple variants, colors, and sizes

Radio

Radio buttons allow users to select a single option from a set of mutually exclusive choices. @duskmoon-dev/core provides a complete set of Material Design 3 radio button variants.

Basic Usage

Simply add the .radio class to an <input type="radio">:

Basic Radio

With Label

Wrap the radio in a label for better UX:

Radio with Label

Checked State

Checked Radio

Sizes

Five sizes are available:

Radio Sizes

Color Variants

Primary (Default)

Primary Radio

Secondary

Secondary Radio

Tertiary

Tertiary Radio

Success

Success Radio

Warning

Warning Radio

Error

Error Radio

Info

Info Radio

All Colors Comparison

All Color Variants

States

Disabled

Disabled Radio

Radio Groups

Vertical Group (Default)

Vertical Radio Group

Select a plan

Horizontal Group

Horizontal Radio Group

Form Integration

Radio in Form

Shipping Method

Best Practices

Usage Guidelines

  1. Use for mutually exclusive choices: Radio buttons are ideal when users can select only one option
  2. Provide clear labels: Each option should have a descriptive label
  3. Default selection: Consider providing a sensible default selection
  4. Limit options: Keep the number of options manageable (typically 2-7 items)

Accessibility

  • Use semantic <label> elements to associate labels with radio buttons
  • Ensure all radio buttons in a group share the same name attribute
  • Support keyboard navigation (built-in with native inputs)
  • Provide meaningful labels

Touch Targets

The radio provides adequate touch targets. For mobile-first designs, use larger sizes:

Mobile-Friendly Radio

API Reference

Class Names

ClassDescription
.radioBase radio styling (required, on input element)
.radio-xsExtra small size (14px)
.radio-smSmall size (16px)
.radio-mdMedium size (20px, default)
.radio-lgLarge size (24px)
.radio-xlExtra large size (28px)
.radio-primaryPrimary color variant (default)
.radio-secondarySecondary color variant
.radio-tertiaryTertiary color variant
.radio-successSuccess color variant
.radio-warningWarning color variant
.radio-errorError color variant
.radio-infoInfo color variant
.radio-labelLabel wrapper for radio + text
.radio-groupContainer for vertical radio group
.radio-group-horizontalHorizontal layout modifier
.radio-group-labelGroup label text

HTML Structure

Simple radio:

<input type="radio" name="group" class="radio" />

With label:

<label class="radio-label">
  <input type="radio" name="group" class="radio" />
  <span>Label text</span>
</label>

Radio group:

<div class="radio-group">
  <span class="radio-group-label">Group Label</span>
  <label class="radio-label">
    <input type="radio" name="group" class="radio" value="a" />
    <span>Option A</span>
  </label>
  <label class="radio-label">
    <input type="radio" name="group" class="radio" value="b" />
    <span>Option B</span>
  </label>
</div>

States

StateHow to Apply
Checkedchecked attribute
Disableddisabled attribute
FocusAutomatic via :focus-visible