Back to blocks
BlockeCommerceFree

Recently Viewed Products React component

A browsing history strip grouped into Today, Yesterday and This week: snap-scrolling product cards with viewed times, price drop, back in stock and low stock badges, a quick add button that expands to Added, per-item removal and Clear history with an undo toast, and an empty state.

About the Recently Viewed Products component

Recently Viewed Products brings back the items a shopper has looked at, grouped by when they saw them. It is often the quickest way back to a product someone was comparing or meant to buy.

Badges flag what changed since the last visit, such as a price drop or a restock, and each card can be added to the cart or removed from the history. Clearing everything is one click and can be undone.

When to use it

Show it on the home page, the cart and product pages for returning visitors, fed from local storage or the customer's account history.

Hide it for first-time visitors or when there are fewer than two items; an almost empty history strip looks like a bug.

Installation

Add the Recently Viewed Products component to your project with the shadcn CLI. It lands in components/recently-viewed-products.tsx as plain React + Tailwind CSS source you own and can edit.

Install
Copied!
npx shadcn@latest add @reactframe/recently-viewed-products

Or copy the source by hand and install its dependencies:

Install
Copied!
npm install motion clsx tailwind-merge

More eCommerce components

Wishlist Drawer
Free
Frequently Bought Together
Free
Back-in-Stock Notify
Free
Size Guide Modal
Free
Low Stock Urgency Badge
Free
Sticky Add to Cart Bar
Free