Motionshelf
← All components

Commerce

Add to Cart

A click on the button sends the product flying into the cart; the badge bumps and the total climbs.

Install

npx shadcn@latest add https://motionshelf-pi.vercel.app/r/add-to-cart.json

Copies the file into your project. Requires React 19, Tailwind CSS v4 and GSAP (installed as a dependency).

Props

NameTypeDefaultDescription
storestring"Studio Shop"Store name in the top bar.
productstring"Stoneware Mug"Product name.
detailstring"Handmade · 350 ml"Short line under the product name.
pricenumber24Product price.
itemsnumber2Items already in the cart before the click.
totalnumber58Cart total before the click.
currencystring"USD"ISO 4217 currency code.
localestring"en-US"Locale used to format the prices.
ctastring"Add to cart"Button text before the click.
addedstring"Added"Button text after the click.
accentstring"#1f5bff"Color of the button, the badge and the product tile.
loopbooleantrueReplay forever with a pause between runs.
classNamestring""Extra classes for the outer element.

Dependencies

  • gsap
  • @gsap/react