OptionCards present the functionality of a radio or checkbox in a more visually prominent card format with an increased click area.
The OptionCard component renders a native HTML <input> element (either type="radio" or type="checkbox", depending on configuration) wrapped inside a <label> element. The wrapping <label> makes the entire card surface a click target for the input, so users can select or deselect the card by clicking anywhere within it. The input is visually hidden but remains in the accessibility tree. The card's title or ariaLabel provides its accessible name.
When used inside an OptionCardGroup, the group renders as a <fieldset> element with an optional <legend>, giving assistive technology a semantic boundary for the set of related options. Title and description text within each card render as <span> elements with no inherent accessible roles.
| Element | Attribute | Description |
|---|---|---|
| Fieldset | aria-label | Provides an accessible name for the OptionCardGroup when no visible legend is rendered. |
| Fieldset | aria-labelledby | References an external element that labels the OptionCardGroup. |
| Input | aria-describedby | References an external element that provides additional context for the input. |
| Input | aria-label | Provides an accessible name when no visible title is rendered. |
| Input | aria-labelledby | References an external element that labels the input. |
Icons and custom images inside the card are treated as decorative. The icon prop renders an Icon component that receives a color adjustment when disabled but carries no accessible name of its own. The iconSrc prop renders an Image with an empty alt attribute, ensuring screen readers skip it entirely. Meaning should always come from the card's title or ariaLabel, never from the icon or image alone.
We highly recommend adding a visible title with the title prop. If a visible title is unneeded for the use case, add an ariaLabel or ariaLabelledby so assistive technology will announce the card to the user. Because the <label> element wraps both the input and the card content, the title text automatically serves as the input's accessible name without requiring explicit ID linking.
| Key | Function |
|---|---|
| Space | Toggles the card when the input type is checkbox. Selects the card when the input type is radio. |
| Shift+Tab | Moves focus to the previous focusable element. |
| Tab | Moves focus to the next focusable element. Within a radio group, only the selected (or first) radio is in the tab order. |
| ↑↓←→ | Moves selection between radio inputs within the same group. Not applicable to checkbox inputs. |