Checkbox

2 Checkbox variations from the W3C ARIA Authoring Practices Guide.

Checkbox

Independent two-state custom checkboxes grouped by a named fieldset.

Corresponding W3C APG example

Example

Sandwich toppingsTomato Lettuce Mustard

Keyboard interaction

Tab moves between checkboxes. Space changes the checked state.

Events

Listen on the widget or delegate to <axxy-scope> or document. All custom events bubble.

  • input / change — Dispatched when the checked or mixed state changes. (target: <input type="checkbox"> / [role="checkbox"], detail: Native Event)

Events reference and examples

Example HTML

<axxy-scope>
  <fieldset>
    <legend>Sandwich toppings</legend>
    <span role="checkbox">Tomato</span>
    <span role="checkbox" aria-checked="true">Lettuce</span>
    <span role="checkbox">Mustard</span>
  </fieldset>
</axxy-scope>

Checkbox (Mixed-State)

A tri-state controller tracks its checkbox group and remembers the last partial selection.

Corresponding W3C APG example

Example

Sandwich toppings

Keyboard interaction

Space cycles the controller through unchecked, remembered mixed selection, and checked. Child checkboxes independently update the controller.

Events

Listen on the widget or delegate to <axxy-scope> or document. All custom events bubble.

  • input / change — Dispatched when the checked or mixed state changes. (target: <input type="checkbox"> / [role="checkbox"], detail: Native Event)

Events reference and examples

Example HTML

<axxy-scope>
  <fieldset>
    <legend>Sandwich toppings</legend>
    <button type="button" role="checkbox" aria-checked="mixed">All toppings</button>
    <label>
      <input type="checkbox" checked>
      Tomato
    </label>
    <label>
      <input type="checkbox">
      Lettuce
    </label>
    <label>
      <input type="checkbox">
      Mustard
    </label>
  </fieldset>
</axxy-scope>