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 toolbar with Add, Remove and a cart disclosure button using aria-expanded. The button name includes the live count and the live region announces every change.
- Keyboard. Tab reaches the toolbar, arrow keys move between the three buttons, Enter or Space activates. Remove is disabled when the cart is empty. Focus rings are always visible.
- Pointer and touch. Hit targets are at least 44px. Click the 3D trolley to add another item. Nothing depends on dragging.
- Reduced motion. With reduced motion the trolley sits in or out of view with no rolling, items appear in the basket with no bounce, and there are no sparks or shake.