Skip to content

Radio Group ​

catnip-radio-group is a role="radiogroup" field whose rows are native radios, and it behaves like a native radio group from the keyboard. You provide the group label and validation messages.

Keyboard ​

Keyboard navigation behaves exactly like a native radio group:

KeyBehaviour
Arrow keysChange the selection.
TabFocuses the checked option.

Screen readers ​

PartSemantics
Grouprole="radiogroup" with aria-labelledby pointing at the field label when visible.
RowA native radio inside an internal catnip-radio (see Radio — Accessibility). Row intent="danger" sets aria-invalid on that radio's native input.
  • With required, the radiogroup sets aria-required="true", so the group is announced as required.

With intent="danger", the radiogroup has aria-invalid="true", and its supporting text also describes every radio, because screen readers don't all read a group's description when focus moves into it.

info renders a button after the label, named “More information about {label}” and described by the info text, which shows as a tooltip on hover and focus; Escape hides it. Content in label.action and label.suffix sits beside the <label>, not inside it, so it isn't part of the field's name.

Visual ​

  • With readonly, the radiogroup gets aria-readonly, the options keep the same focus ring as editable ones, and arrow keys move focus without changing the selection.

What you own ​

  • Label: Set label (or the label slot). With hide-label, set radio-group-aria-label to name the group.
  • Validation messages: Put group-level copy in supporting-text and row-level copy in each option's supportingText, each with its intent (see Validation).
  • Errors on submit: Supporting text isn't a live region, so a message that appears later isn't announced by itself. On submit, move focus to the first invalid field or to an error summary.
  • Outside label or description: A <label for> or catnip-field-label html-for that points at the catnip-radio-group element's id names the inner control when the field has no label of its own, and clicking it focuses the selected option, or the first one. IDs in aria-describedby (ariaDescribedby) are looked up in the page, or in the shadow root the element sits in, and read before the supporting text. Both are connected through element reflection; axe-core 4.11 doesn't read reflection yet and still reports label for an outside label.

WCAG 2.2 AA ​

CriterionThe componentYou
1.3.1 Info and relationships, 4.1.2 Name, role, valueA named radiogroup with aria-required, aria-invalid and aria-readonlyA group label
2.1.1 KeyboardOne Tab stop; arrow keys move and select, skipping disabled options—
2.4.7 Focus visibleA focus ring in every state, read-only and Windows contrast themes includedDon't override focus styles
3.3.1 Error identificationIn danger, the group message describes every radioA sensible default, or an error when nothing is chosen

This table says who handles what. It isn't a conformance claim: WCAG conformance is claimed for a page or a process.

Known issues ​

None known.

Catnip Design System by Signicat