Componentfeedback1.6 KB gzipZero dependencies
Cart Drawer
Slide-over cart drawer with quantity controls and animated removal.
Preview
Live Preview
Installation
Tokens guide →Add to your project via CLI (zero dependencies, code you own):
npx bigbullui add cart-drawerOr install the full npm package:
npm install bigbulluiUsage
tsx3 lines
import { CartDrawer } from "@/components/ui/cart-drawer"; <CartDrawer />Source code
cart-drawer.tsx + 2 helpersZero third-party dependencies (3 local files shown in tabs below).
tsxcart-drawer.tsx184 lines
"use client"; import * as React from "react";import { createPortal } from "react-dom";import { cn } from "./lib/utils";import { getFocusable, lockBodyScroll, registerEscapeLayer, trapFocus } from "./lib/focus-trap"; export interface CartDrawerItem { id: string; title: string; price: string; qty: number;} export interface CartDrawerProps { open: boolean; onOpenChange: (open: boolean) => void; items: CartDrawerItem[];Props
Interactive Prop Playground
Tweak parsed AST props below to generate ready-to-paste JSX.
tsx3 lines
import { CartDrawer } from "@/components/ui/cart-drawer"; <CartDrawer />| Prop | Type | Description |
|---|---|---|
| open | boolean | Controlled open visibility state. |
| onOpenChange | (open: boolean) => void | Callback invoked on open change. |
| items | CartDrawerItem[] | Structured list of items rendered by the component. (Default: []) |
| onRemove | (id: string) => void | Callback invoked on remove. |
| onQtyChange | (id: string, qty: number) => void | Callback invoked on qty change. |
| className | string | Optional Tailwind or custom CSS classes merged with component styles. |