Skip to content

Checkbox Group

Coordinate a group of native checkboxes. Custom element

Checkbox Group
Copy this markup
<ui-checkbox-group aria-labelledby="features-label">
<span id="features-label">Features</span>
<label>
<input type="checkbox" name="features" value="documentation" checked>
Documentation
</label>
<label>
<input type="checkbox" name="features" value="playground">
Playground
</label>
</ui-checkbox-group>

Install

Styles and registration
import '@timelessui/components/css/tokens.css'
import '@timelessui/components/css/choice-group.css'
import '@timelessui/components/define/ui-checkbox-group'

Anatomy

Parts are authored in your own markup and identified by the selector below, so your CSS can target the same anatomy without loading Timeless styles. Required parts must be present for the component to work. Private data-ui-internal-* hooks are written by the runtime and must never be authored.

PartRequiredSelectorPurpose
choiceYesinput[type='checkbox']One native checkbox input. Author checked for the initial state; the group reports every checked value.

Attributes

Every value below is implemented by the stylesheets this component ships. Boolean attributes are presence-based: author the attribute with no value, or omit it.

AttributeValuesDefaultDescription
orientationvertical · horizontalverticalLayout and arrow-key axis.

Element API

Attributes above are the authoring surface. These are the DOM properties and events the registered element adds once it upgrades.

<ui-checkbox-group>

PropertyTypeNotes
orientation'vertical' | 'horizontal'Reflects the orientation attribute, documented above.
EventDetailDescription
ui-before-changeCustomEvent<CheckboxGroupChangeDetail>Cancelable proposal dispatched before the set of checked boxes changes. Call preventDefault() to reject the transition and keep the current value.
ui-changeCustomEvent<CheckboxGroupChangeDetail>Dispatched after the set of checked boxes has changed. Bubbles and is composed.

Styling

Root identity: ui-checkbox-group. Required stylesheets: tokens.css, choice-group.css.

This component adds no custom properties of its own. Restyle it through the design tokens or your own CSS.

Design tokens this component reads (7)

These are global Atmosphere tokens. Change them once at the theme level rather than per component.

--ui-accent · --ui-disabled-opacity · --ui-fg · --ui-fg-muted · --ui-focus · --ui-space-2 · --ui-space-3

Accessibility

Keep the native elements, roles, and relationships shown in the example. Timeless adds only the state and keyboard coordination the platform does not already provide, and it never supplies your accessible names — those depend on your content.

Follows the Checkbox pattern from the ARIA Authoring Practices Guide.

KeyAction
Arrow keysMove focus to the previous or next checkbox, following the orientation and skipping disabled ones.
Home / EndMove focus to the first or last enabled checkbox.
Page Up / Page DownJump ten checkboxs at a time.

Space toggles the focused checkbox natively. Every box remains independently reachable and submits its own value.

Before JavaScript runs

The markup above is complete and usable on its own: native controls submit, labels associate, and authored ARIA is already correct. Registration adds state synchronisation, focus management, and keyboard coordination on top of it.

More examples

Open Checkbox Group in StoryLite for variants, controls, and manual testing.