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
nameattribute
Don't
- Use a single radio on its own - use a checkbox or switch
- Nest radios inside other interactive controls
API
Slots
| Slot | Required | Description |
|---|---|---|
label | Yes | Visible label text for the radio button. |
Props
| Prop | Type | Default | Description |
|---|---|---|---|
name | string | - | Name attribute for grouping radio inputs. |
value | string | - | Value attribute for the input element. |
id | string | - | HTML id of the input. Used to associate the label. |
is_checked | boolean | - | Renders the checked attribute. |
is_disabled | boolean | - | Renders the disabled attribute and adds aria-disabled to the label. |
is_invalid | boolean | - | Marks the control as invalid. Renders aria-invalid="true" when set. |
classes | array | - | Additional CSS class words merged into the root element. |
attributes | object | - | Additional HTML attributes spread on the root element. |
Classes
| Class | Capability | Default | Description |
|---|---|---|---|
.sm | Size | - | Small. |
.md | Size | Yes | Medium. |
.lg | Size | - | 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-motionvia the chained--option-animationsand--option-radio-animationsmultipliers