Android — Material 3 JS behaviour

Selection controls

The M3 switch, checkbox and radio with their official motion: the switch thumb scales its check icon from inside, the checkbox draws its tick as an SVG path, the radio ripples from centre.

Documentation

Real scenarios

The component as it is used in a product — not a specimen grid.

Notification settings

The switch thumb grows from 16 to 24 px and its dash becomes a tick, the checkbox draws its SVG tick, the radios ripple from centre, and every row carries the 12% state layer.

Delivery


Digest


Alert style

The three controls

Off state uses the outline colour, on state pairs tone 90 with tone 10 — the exact Material pairing for contrast.

switch · 52×32
checkbox
radio

Important props

Important props
Prop Type Default What it does
switch: track size '52 × 32' A 52×32 track and a 16→24px thumb; off shows a dash, on shows a tick.
state-layer overlay '12%' The state layer on press; a long press fills it in.
error color '#B3261E' Material’s error colour for the invalid state of all three.

Snippet

<label class="m3sel-switch">
    <input type="checkbox" role="switch">
    <span class="m3sel-track"><span class="m3sel-thumb"></span></span>
</label>

<label class="m3sel-check">
    <input type="checkbox"><span class="m3sel-box"><svg viewBox="0 0 24 24"><path d="M5 12l5 5 9-10"/></svg></span>
</label>

<style>
.m3sel-switch input:checked + .m3sel-track { background: #6750A4; }
.m3sel-track { inline-size: 52px; block-size: 32px; border-radius: 999px; background: #E6E0E9; border: 2px solid #79747E; }
.m3sel-thumb { inline-size: 16px; aspect-ratio: 1; border-radius: 50%; background: #79747E; transition: all .2s; }
.m3sel-switch input:checked + .m3sel-track .m3sel-thumb { inline-size: 24px; translate: 20px 0; background: #fff; }
</style>