Skip to content

Radio ​

catnip-radio uses a visually hidden native <input type="radio"> for semantics and keyboard support, including the invalid and read-only states. You provide the option label.

Keyboard ​

KeyBehaviour
SpaceSelect the radio when focused.

Standalone radios don't move with the arrow keys and each is its own Tab stop, even when they share a name: every catnip-radio has its own shadow root, and native radio grouping only works inside one. Use Radio Group for a set of options; in development a console warning fires when standalone radios share a name.

A read-only radio remains in the keyboard focus model while pointer and keyboard selection changes are prevented.

Screen readers ​

  • The native radio input drives the semantics.
  • intent="danger" sets aria-invalid for validation states.
  • readonly: HTML has no read-only radio, and aria-readonly belongs on a radiogroup, not a radio. A standalone read-only radio adds a hidden “Read-only” (locale key fieldLabel.readonly) to its description instead; it used to set aria-disabled, which was heard as “unavailable”. Inside catnip-radio-group, the group's readonly puts aria-readonly on the radiogroup.

Visual ​

  • A read-only radio shows the same focus ring as an editable one, and keeps its read-only fill and border.

What you own ​

  • Label: Provide a visible label in the default slot, or set radio-aria-label when the slot is empty.
  • Grouping: Put related options in catnip-radio-group, which gives one Tab stop, arrow keys, and a named group. Don't build a group from standalone catnip-radio elements.
  • 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 element's id names the inner control when the field has no label of its own, and clicking it focuses and selects the radio. 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, valueNative radio; read-only adds a hidden “Read-only” instead of being heard as unavailablePut related radios in catnip-radio-group
2.1.1 KeyboardSpace selectsUse catnip-radio-group for arrow keys and one Tab stop
2.4.7 Focus visibleA focus ring in every state, read-only and Windows contrast themes includedDon't override focus styles
2.5.8 Target sizeThe whole row, circle and label, is the target—

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

Known issues ​

  • Standalone radios don't form a group, even with a shared name: each has its own shadow root. Use Radio Group.

Catnip Design System by Signicat