Component
Fridge-Magnet Tag Input
Variants
The same markup drops into a normal page as a compact CSS magnet board (no WebGL needed). It re-themes with the colour tokens. Sizes and states below.
Usage
Paste the markup, include assets/css/tokens.css and assets/css/tailwind.css, then run the script from this page. Listen for fmti:change to get the tag list.
Accessibility
- Role and state. A labelled text input with an Add button, and the tags as a real list of buttons named "Remove tag ...". On the 3D stage those buttons are invisible and sit on the magnets, so screen readers and keyboards reach every tag. A polite live region announces each add, remove and error.
- Keyboard. Enter or comma adds the tag, Backspace in an empty input removes the last one, Escape clears the field. Tab to a tag, then Enter, Space, Delete or Backspace pops it off, and the arrow keys move between tags.
- Reduced motion. With prefers-reduced-motion the magnets appear on the door without the flight, spin or sparks, and removed magnets vanish in place; the list, counter and live region behave the same.
- Touch and pointer. Magnets drag with pointer capture and touch-action off on the stage; a tap pops a magnet off, a drag re-sticks it, a drag past the door edge drops it. Duplicates and a full board (12 tags) shake the input and say why.