Skip to main content

Radio

Radio button form control. Reach for a radio when a user must pick exactly one option from a small set of mutually exclusive choices. Uses native <input type="radio"> styled via appearance: none with a custom dot pseudo-element.

Usage​

When to use

  • Picking one option from a small, known set of choices
  • Settings where the options should all be visible at once

When not to use

  • Picking one option from a large set - use a select
  • Picking multiple options - use checkboxes
  • Toggling a single binary setting - use a switch

Do

  • Always pair each radio with a <label>
  • Provide a default selection when one is clearly expected
  • Group related radios with the same name attribute

Don't

  • Use a single radio on its own - use a checkbox or switch
  • Nest radios inside other interactive controls

API​

Slots​

SlotRequiredDescription
labelYesVisible label text for the radio button.

Props​

PropTypeDefaultDescription
namestring-Name attribute for grouping radio inputs.
valuestring-Value attribute for the input element.
idstring-HTML id of the input. Used to associate the label.
is_checkedboolean-Renders the checked attribute.
is_disabledboolean-Renders the disabled attribute and adds aria-disabled to the label.
is_invalidboolean-Marks the control as invalid. Renders aria-invalid="true" when set.
classesarray-Additional CSS class words merged into the root element.
attributesobject-Additional HTML attributes spread on the root element.

Classes​

ClassCapabilityDefaultDescription
.smSize-Small.
.mdSizeYesMedium.
.lgSize-Large.

Examples​

Default​

Standard radio input with a label.

Sizes​

Sm, default, and lg variants stacked vertically. The dot scales with the surrounding circle.

Motion​

Animation is on by default and is controlled by two chained CSS custom properties: the global --option-animations and the component-scoped --option-radio-animations. The transition duration resolves as base × --option-radio-animations × --option-animations. Set either factor to 0 (inline on a single radio, scoped on the fieldset, or globally) to disable the radio transition. prefers-reduced-motion: reduce already zeroes --option-animations automatically.

Checked​

Radio in its checked state.

Disabled​

Disabled radio input.

Invalid​

Radio marked as invalid via aria-invalid.

Wrapping​

The consumer-authored <label><input type="radio" name="..."> Text</label> form. Semetrika's twig template emits the sibling form (<input> + <label>), but page authors and CMS integrations frequently hand-write the wrapping form for inline radio rows (payment-method choices, ticket tiers, etc.). The wrapping label renders as inline-flex with align-items: center so the glyph and the surrounding text share a true vertical center.

Accessibility​

  • WCAG 2.2 AA
  • Native <input type="radio"> semantics preserved
  • Label association via <label> element
  • Visible focus ring on keyboard navigation
  • Validation state exposed via aria-invalid
  • Animation respects prefers-reduced-motion via the chained --option-animations and --option-radio-animations multipliers
  • checkbox - pick multiple options from a set
  • switch - binary on/off toggle
  • select - pick one option from a large set