Color Radio Input
ColorRadioInput is a headless native <input type="radio"> for one choice of a colour swatch, used inside a ColorRadioGroup. Because it is a real radio, the group gets native arrow keys, form submission and form reset.
Status: experimental — new (2026-11-15), implemented and unit-tested in every headless library; not yet exercised in a composed flow.
Usage
<ColorRadioGroup label="Highlight colour">
<ColorRadioInput
color="#005eb8"
label="Blue"
name="colour"
checked
/>
<ColorRadioInput
color="#007f3b"
label="Green"
name="colour"
/>
<ColorRadioInput
color="#d5281b"
label="Red"
name="colour"
/>
</ColorRadioGroup>
Props
color: string (required) -- the CSS colour this option stands for, exposed as data-color and the --color-radio-input-color custom property
label: string (required) -- accessible name via aria-label, the colour's name in words
name: string (default: undefined) -- radio group name
value: string (default: the colour) -- the submitted value
checked: boolean (default: false) -- whether this radio starts checked
disabled: boolean (default: false) -- whether this radio is disabled
...restProps: any additional HTML attributes spread onto the input
Keyboard Interactions
- Tab: focus the checked radio in the group, or the first if none is checked
- ArrowDown / ArrowRight: move to and check the next radio
- ArrowUp / ArrowLeft: move to and check the previous radio
- Space: check the focused radio
ARIA
aria-label={label} names the radio; the native radio role and checked state need no ARIA
- The colour's name is in the label, so the choice is never colour alone (WCAG 1.4.1)
When to Use
- Use inside a
ColorRadioGroup, one radio per colour.
- Use when a form must submit the chosen colour without script.
- Use when consumer CSS should draw each option from
data-color or --color-radio-input-color.
When Not to Use
- Do not use alone for a yes/no choice -- a lone radio cannot be unchecked; use CheckboxInput instead.
- Do not use outside its group -- put every option in one ColorRadioGroup with a shared
name.
- Do not use for an option with no colour meaning -- use RadioInput instead.
Headless
The ColorRadioInput headless component renders a native radio with aria-label, data-color and one CSS custom property carrying its colour. The consumer provides all visual styling.
Styles
The consumer provides all CSS styling. The component renders with a .color-radio-input class for targeting; paint the swatch from var(--color-radio-input-color). No default styles are included — this is a fully headless component.
Testing
- Verify the component renders an
<input type="radio"> with class color-radio-input
- Verify
aria-label, name, checked and disabled
- Verify
data-color, the custom property, and the colour as the default value
- Verify Tab reaches it and Space checks it
Advice
- Designers: Pair every swatch with words; colour alone is not enough.
- Developers: Give every radio in the group the same
name, and a visible <label> where the layout allows one.
Implementation Notes
- Renders a native
<input type="radio"> with aria-label
- Sets
data-color and the --color-radio-input-color custom property to its colour, so consumer CSS can paint the swatch (background: var(--color-radio-input-color)); the component sets no other style
- Submits its colour unless a
value is given
- No two-way binding: the checked state is the browser's, and
checked sets where it starts
Related components
color-radio-group — a fieldset radio group for selecting a color swatch
color-input — a native colour field
radio-input — the general radio input
References
Lily™ and Lily Design System™ are trademarks.
Canonical contract
Generated from this component's canonical metadata — the machine-checked source the implementations are held to.
Metadata
- Component: color-radio-input
- PascalCase: ColorRadioInput
- Description: a radio input for one choice of a color swatch <input type="radio">
- Status: experimental — new (2026-11-15), implemented and unit-tested in every headless library; not yet exercised in a composed flow
- HTML tag: <input>
- CSS class: .color-radio-input
- Interactive: no
ARIA
aria-label={label} -- the radio's accessible name, the colour's name, so meaning is never colour alone
Keyboard
- **Tab**: Moves focus to the checked radio in the group (or the first if none is checked)
- **Arrow Up / Arrow Left**: Moves to and checks the previous radio in the group
- **Arrow Down / Arrow Right**: Moves to and checks the next radio in the group
- **Space**: Checks the focused radio
Props
color: string (required) -- the CSS colour this option stands for, exposed as data-color and the --color-radio-input-color custom property label: string (required) -- accessible name via aria-label, the colour's name in words name: string (default: undefined) -- radio group name value: string (default: the colour) -- the submitted value checked: boolean (default: false) -- whether this radio starts checked disabled: boolean (default: false) -- whether this radio is disabled ...restProps: any additional HTML attributes spread onto the input