Open experiment
Magnetic add-to-cart control
Pulls the product token into a cart target while updating quantity and total. Activation animates a contained product token, increments the cart badge, and announces the total. Connects purchase action to a persistent cart destination rather than only changing button text.
Lab tested Responsive Dark mode Interactive
- Version
- 1.0.0
- Updated
- 2026-08-02
- Dependencies
- Zero
<article class="cmp-magnetic-add-to-cart cmp-atlas" data-state="idle" data-variant="2">
<div class="cmp-atlas__product">
<span>Edition 07</span>
<div aria-hidden="true"><i></i><i></i><b>Ma</b></div>
<em>Available now</em>
</div>
<div class="cmp-atlas__commerce-body">
<span>Purchase actions</span>
<h3>Magnetic add-to-cart</h3>
<div class="cmp-atlas__price"><b>$96</b><small data-output>In stock · ships today</small></div>
<div class="cmp-atlas__choices">
<button type="button" data-choice="0" aria-pressed="true">Ion</button
><button type="button" data-choice="1" aria-pressed="false">Nova</button
><button type="button" data-choice="2" aria-pressed="false">Halo</button>
</div>
<button
type="button"
class="cmp-atlas__primary"
data-primary
data-active-label="Added · view cart"
aria-pressed="false"
>
Add to cart
</button>
<p data-status aria-live="polite">Choose an option to continue</p>
</div>
</article>
No runtime reactions detected Open in Editor
Validated in the lab
Experiment report
- Schema and source files passed
- Responsive test passed
- Keyboard test passed
- No console errors
Component ingredients
- Dependencies
- None
- Browser support
- Current Chrome, Current Edge, Current Firefox, Current Safari
- Version
- 1.0.0
- Last tested
- 2026-08-02
Accessibility notes
- Every interactive target is a labelled native control with a visible focus treatment.
- State changes are communicated through a polite text status and never by color alone.
- The contained visual effects stop when the user requests reduced motion.
License: MIT License for open-source use, modification, and distribution.