Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Sheet examples · Details

Product Details Sheet for React

A right-side sheet with a product image, price, stock badge, feature list and an Add to Cart button.

Framework
UI library

A quick product view in a right-side sheet: the image, an In Stock Badge next to the price, a short feature list and Add to Cart. Shoppers check the details and add the product without leaving the grid they're browsing.

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

What does the product sheet show?

Premium Headphones as the title, a one-line description, a 400 by 300 placeholder image, the In Stock badge, the price $299.99, four features and a full-width Add to Cart button.

How do I use a real product photo?

Swap the src for your image and keep alt, width and height so the panel doesn't jump when it loads. The image is w-full rounded-md object-cover, so it fills the panel's width.

How do I show out of stock?

Change the badge to Out of Stock with variant="secondary" or outline, and disable Add to Cart. The word carries the state, so it doesn't rely on color.

Does Add to Cart close the sheet?

No, it's a plain Button. To close after adding, control the open state: Pass open to Sheet; onOpenChange receives the next boolean.

How does View Details open the sheet?

The outline button labeled View Details is the trigger, and its text is the accessible name. The Button goes in the render prop of SheetTrigger, and the label stays its child.

What does the product sheet announce?

SheetTitle names the dialog for assistive tech, so every sheet renders one; hide it with sr-only when the design has no visible heading. The product name is the title, and High-quality wireless headphones with noise cancellation is the description.