Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Carousel examples · Standard

Product Showcase Carousel for React

A product carousel whose cards show an image, a badge, a star rating, a price and an Add to Cart button.

Framework
UI library

Featured items, new arrivals, related products: a store needs more than pictures in a slider. This React carousel shows one product card per slide, with a picture, a New, Sale or Popular badge, a star rating with the review count, the price and an Add to Cart button. Use it for a homepage shelf or a related-products row.

Preview

Preview width

Installation

Sign in to get your install command
Free with an account. It carries your token, so the CLI installs everything in one go.

FAQ

When should I use a product carousel instead of a grid?

For a short, picked set of 5 to 12 items, such as deals or recommendations, where you lead the eye one product at a time. When people need to compare prices or filter, a grid works better.

How do I use my own products?

Replace the products array: each entry has a name, price, rating, reviews and a badge that can be null. Swap the placeholder image src for each product's photo, and keep alt set to the product's name.

How are the stars filled?

Five StarIcons. A star is fill-primary text-primary when its number is at most the rating rounded down, and fill-muted text-muted otherwise, so 4.6 shows four stars. The rating and the review count follow as text, which is what a screen reader reads.

When does the badge show?

When the product's badge is set. It's a Badge with absolute end-4 top-4 in the image's corner, and a null badge renders nothing.

How do I show several products at once?

Give CarouselItem a width class such as basis-1/2, and widen the wrapper from max-w-sm.

How do I wire Add to Cart?

Give the button a click handler that adds the product to your cart state or calls your API. The demo has none. Confirm the action with a toast or by changing the label to Added.