Back to blocks
BlockeCommerceFree

Sticky Add to Cart Bar React component

A product page whose buy box hands off to a floating add-to-cart bar once the main button scrolls away: product thumb, live variant summary, an upward size menu, quantity, price and an Add to cart button that turns into Added while the cart count bumps.

About the Sticky Add to Cart Bar component

Sticky Add to Cart Bar keeps the buy button within reach on long product pages. While shoppers read the details, specs and photos, a slim bar slides up from the bottom with the product, the chosen options, the price and an Add to cart button.

It appears only once the main button has scrolled out of view, so it never duplicates a button that is already on screen. Tapping the product in the bar scrolls back to the options, and adding shows a clear Added state while the cart count bumps.

When to use it

Use it on product pages with long descriptions, reviews or lifestyle photos below the buy box, especially on phones where the main button quickly scrolls away.

On short product pages where the buy button stays visible, skip it; a bar that pops up for a moment adds noise without helping.

Installation

Add the Sticky Add to Cart Bar component to your project with the shadcn CLI. It lands in components/sticky-add-to-cart-bar.tsx as plain React + Tailwind CSS source you own and can edit.

Install
Copied!
npx shadcn@latest add @reactframe/sticky-add-to-cart-bar

Or copy the source by hand and install its dependencies:

Install
Copied!
npm install motion clsx tailwind-merge

More eCommerce components

Size Guide Modal
Free
Write a Review Form
Free
Frequently Bought Together
Free
Photo Review Gallery
Free
Recently Viewed Products
Free
Rating Summary Breakdown
Free