shadcn.io is an independent project built on shadcn/ui
Cart (3) opens a right panel. Wireless Headphones, a USB-C cable, and a phone case each have a price and a remove button. The total reads $157.00, then Checkout and Continue Shopping.
Use it so shoppers can check the cart without leaving the product. A long cart belongs on a page, not in a Sheet. In React, Base UI does not update the total.
Installation
Anatomy

Usage
<Drawer swipeDirection="right">
<DrawerTrigger render={<Button variant="outline" />}>
<ShoppingCartIcon aria-hidden="true" data-icon="inline-start" />
Cart (3)
</DrawerTrigger>
<DrawerContent>
<DrawerHeader>
<DrawerTitle>Shopping Cart</DrawerTitle>
<DrawerDescription>3 items in your cart</DrawerDescription>
</DrawerHeader>
<div className="flex min-h-0 flex-1 flex-col gap-4 overflow-y-auto p-4">
<ul className="flex flex-col gap-4">
{CART_ITEMS.map((item) => (
<li className="flex gap-4 border-b pb-4" key={item.id}>
<div className="size-20 shrink-0 rounded-md bg-muted" />
<div className="flex flex-1 flex-col gap-1">
<h3 className="font-medium text-sm">{item.name}</h3>
<p className="text-muted-foreground text-xs">{item.variant}</p>
<div className="flex items-center justify-between">
<span className="font-medium text-sm">{item.price}</span>
<Button
aria-label={`Remove ${item.name}`}
size="icon-xs"
variant="ghost"
>
<Trash2Icon aria-hidden="true" />
</Button>
</div>
</div>
</li>
))}
{/* The rest of the file is under Installation. */}FAQ
What does each cart item show?
An image placeholder, the name, the variant, the price and an icon-only remove button. The items come from a static array with an id each for the key.
How is the remove button labeled?
It's icon-only, so aria-label names the item, such as Remove Wireless Headphones. The trash icon is aria-hidden.
Are the totals calculated?
No, they're written out: $147.00, $10.00 and $157.00, in a description list. Compute them from your cart and format them with Intl.NumberFormat.
What do Checkout and Continue Shopping do?
Continue Shopping is a DrawerClose, so it dismisses the drawer. Checkout has no handler: send people to your checkout from it.
API Reference
Drawer
Sets swipeDirection="right". The rest is on the Drawer page.
Button
Sets variant="outline", aria-label, Remove, item, name and size="icon-xs". The rest is on the Button page.





