Componentfeedback1.6 KB gzipZero dependencies

Cart Drawer

Slide-over cart drawer with quantity controls and animated removal.

Preview

Live Preview
Open ↗

Installation

Tokens guide →

Add to your project via CLI (zero dependencies, code you own):

npx bigbullui add cart-drawer

Or install the full npm package:

npm install bigbullui

Usage

tsx3 lines
import { CartDrawer } from "@/components/ui/cart-drawer"; <CartDrawer />

Source code

cart-drawer.tsx + 2 helpers

Zero 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 />
PropTypeDescription
openbooleanControlled open visibility state.
onOpenChange(open: boolean) => voidCallback invoked on open change.
itemsCartDrawerItem[]Structured list of items rendered by the component. (Default: [])
onRemove(id: string) => voidCallback invoked on remove.
onQtyChange(id: string, qty: number) => voidCallback invoked on qty change.
classNamestringOptional Tailwind or custom CSS classes merged with component styles.