Variants
Sizes and states, all built from the same markup.
Usage
Paste the markup, include assets/css/tokens.css and assets/css/tailwind.css, then run the script from this page.
Accessibility
- Role and state. A real button with role="checkbox" and aria-checked, as in Radix and shadcn. The label is its visible text; a polite live region announces "Mail sent, flag up" or "Mail collected, flag down". The 3D scene is aria-hidden decoration.
- Keyboard. Tab to focus, Space toggles (Enter works too). The focus ring uses the --ring token; the keyboard posts the same letter as the mouse.
- Reduced motion. With prefers-reduced-motion there are no flying letters, spring or fireflies: the flag and the street jump to raised or lowered and the label changes.
- Contrast. Colours come from the tokens, which keep AA contrast in light and dark and in every preset.