Radio group

stable 1.9 kB
<hk-radio-group>

A radio set with roving tabindex: one tab stop for the group, arrows to move within it. That is the ARIA pattern, and it is what keyboard users expect.

#choice
In the package npm i hellskitchen-ui Import hk-radio-group and use it directly.

Live demo

Running in this page — interact with it.

Inputs

NameTypeDefaultDescription
valueunknownnullSelected value. Two-way bindable.
optionsHkRadioOption[][]Choices. Each may carry a label and a hint line.
orientationHkRadioOrientation'vertical'Layout direction: 'vertical' | 'horizontal'. Both arrow axes move in either layout.
labelstring''Group label, exposed on the radiogroup.

Outputs

  • valueChangeEventEmitter<unknown>

    Emits on selection.

Keyboard

  • ↑ / ← Previous option, wrapping at the start
  • ↓ / → Next option, wrapping at the end
  • Tab Leaves the group — it is one stop, not one per radio

Theming

Component tokens, each falling back to a global one:

PropertyDefaultControls
--hk-radio-dot#dc2626Selected dot colour.
--hk-radio-border#cbd5e1Ring colour when unselected.

Accessibility

  • Only the selected radio is tabbable; the rest are tabindex="-1" and reached with arrows.
  • Selecting on arrow-move matches native radio behaviour, so nothing needs re-learning.

More in Forms