mica

Example

Basic usage

<label><input type="checkbox" role="switch" checked /> Notifications</label>

API

A switch is a native checkbox with the ARIA switch role. Checked, disabled, form participation, labeling, focus, events, and Space-key behavior remain native.

Mica-specific attributes

NameTypeDefaultDescription
role="switch"ARIA rolecheckbox roleSelects Mica's switch track presentation and exposes on/off semantics to assistive technology.

Content/markup contracts

ContentContractDefaultDescription
labelwrap the input or use forProvides the switch's accessible name and click target.

Styling

StateNative sourceDefaultDescription
Offunchecked checkboxinitialMuted track with the block at the start edge.
OncheckedfalsePrimary fill with the block at the end edge.

Accessibility

The checkbox's native checked state supplies the accessible state — do not duplicate it with aria-checked. Safari is prototyping a native switch attribute; if it standardizes, this component will need even less.

← segmented controlfieldset →