140
A slide-over bag with quantity steppers, line totals and subtotal that roll digit by digit, a free-shipping bar that fills as you add, and a friendly empty state.
akacart·shopping cart·bag
Run this in any project set up for the shadcn CLI. It copies the Cart Drawer source into your components folder, so the code is yours to change.
npx shadcn@latest add https://devl.dev/r/cart-drawer.jsonImport it and render it. Every prop has a typed default, so it works straight away, and you pass your own data when you’re ready.
import { CartDrawer } from "@/components/cart-drawer";
export default function Page() {
return <CartDrawer />;
}A free React component in the Commerce collection, written in TypeScript with Tailwind CSS on coss ui. MIT licensed.
Read from the Cart Drawer source. Everything is optional unless it says required.
| Prop | Type | Default |
|---|---|---|
| items | CartLine[] | — |
| defaultItems | CartLine[] | [] |
| onItemsChange | (items: CartLine[]) => void | — |
| open | boolean | — |
| defaultOpen | boolean | false |
| onOpenChange | (open: boolean) => void | — |
| freeShippingAt | number | — |
| currency | string | "USD" |
| locale | string | "en-US" |
| onCheckout | (items: CartLine[], subtotal: number) => void | — |
| children | (cartButton: ReactNode) => ReactNode | — |
| className | string | — |