Drag toggle

Drag across checkboxes or pressed buttons to set them all as the first one flips.

Installation

Examples

Default

Wrap a list in it, and its toggles need no wiring: each flips with a click, so its own handlers run. Dragging back restores the toggles the drag leaves, a drag can start on a label, and only toggles that share the first one's name join in.

demo.tsx

Pressed buttons

Buttons with aria-pressed, such as layers' eyes, toggle the same way.

buttons.tsx
Sky
Subject
Vignette
Grain
Image

One undo per drag

onDraggingChange brackets a drag, so all its clicks can go into one undo step.

undo.tsx

Anatomy

Each part's data-slot, which a theme styles, is beside it.