Skip to content
Alpha

Hololink UI is under active development. Components, APIs and these docs may change without notice.

Holo Radio & Radio Group

<holo-radio-group> is a form-associated custom element that owns the selected value for a set of <holo-radio> children. It manages roving tabindex keyboard navigation (Arrow keys, Home, End) across its options, so only one radio is ever a tab stop at a time.

Use it for:

  • Choosing exactly one option from a short set (roughly two to seven) where seeing every option helps.
  • Settings that submit with a form.

Don’t use it for:

  • Selecting several options. Use Checkbox.
  • Long lists of options. Use Select.
  • Instant on and off settings. Use Switch.
<holo-radio-group label="Size" value="medium">
<holo-radio value="small" label="Small"></holo-radio>
<holo-radio value="medium" label="Medium"></holo-radio>
<holo-radio value="large" label="Large"></holo-radio>
</holo-radio-group>
<holo-radio-group label="Size" value="medium" disabled>
<holo-radio value="small" label="Small"></holo-radio>
<holo-radio value="medium" label="Medium"></holo-radio>
</holo-radio-group>

<holo-radio-group> sets role="radiogroup" on itself. It takes aria-label from label, and sets aria-required and aria-disabled from required and disabled. Each <holo-radio> sets role="radio" and aria-checked on itself, and aria-disabled when disabled. The visible circle is aria-hidden. The group is form-associated through ElementInternals: its value is the selected radio’s value, and required with nothing selected reports “Please select an option.”.

Key Action
Tab Moves focus into the group (to the checked radio, or the first if none) and out of it
ArrowDown, ArrowRight Moves to the next enabled radio (wraps) and selects it
ArrowUp, ArrowLeft Moves to the previous enabled radio (wraps) and selects it
Home Moves to the first enabled radio and selects it
End Moves to the last enabled radio and selects it
Space, Enter Selects the focused radio
  • Radios use roving tabindex: only one radio is a tab stop at a time.
  • Disabled radios are skipped by the arrow keys, Home and End, and are never a tab stop.
  • The checked circle shows a visible focus ring with :host(:focus-visible).

You provide:

  • A label on <holo-radio-group> that names the question (“Delivery speed”). Without it the group has no accessible name.
  • Visible text for each radio, through the label prop or slotted content.
  • Radios inside a <holo-radio-group>. A standalone holo-radio has no roving tabindex and no group semantics.

Importing

import '@philbob-sideprojects/hololink-ui/holo-radio-group';

Properties

PropertyAttributeTypeDefaultDescription
disableddisabledbooleanfalseIf true, the entire group is disabled and non-interactive.
labellabelstring—The accessible label describing the group of radio options.
namenamestring—The form field name submitted with the owning form.
requiredrequiredbooleanfalseIf true, the owning form cannot submit unless a value is selected.
valuevaluestring—The value of the currently selected holo-radio child.

Events

EventDetailDescription
holoChangestringEmitted when the user selects a different option. detail is the new value.

Slots

SlotDescription
(default)The holo-radio options.

CSS custom properties

PropertyDescription
--holo-radio-group-gapSpace between radio options.

Importing

import '@philbob-sideprojects/hololink-ui/holo-radio';

Properties

PropertyAttributeTypeDefaultDescription
checkedcheckedbooleanfalseWhether this radio is the selected option. Managed by the parent holo-radio-group — do not set directly in application code.
disableddisabledbooleanfalseIf true, this radio is disabled and non-interactive.
labellabelstring—The visible label text for the radio option.
value (required)valuestring—The value this radio represents within its owning holo-radio-group.

Events

EventDetailDescription
holoRadioSelectstringEmitted (bubbles + composed) when the user activates this radio, so the owning holo-radio-group can update the selected value.

Slots

SlotDescription
(default)Additional label content rendered after the label text.

CSS custom properties

PropertyDescription
--holo-radio-bgBackground color of the circle.
--holo-radio-border-colorBorder color of the unselected circle.
--holo-radio-checked-colorBorder and dot color of the selected circle.
--holo-radio-text-colorText color of the label.