Componentfeedback1.77 KB gzipZero dependencies
Sheet
Slide-over drawer panel with focus trap and scroll lock.
Preview
Live Preview
Installation
Tokens guide →Add to your project via CLI (zero dependencies, code you own):
npx bigbullui add sheetOr install the full npm package:
npm install bigbulluiUsage
tsx8 lines
import { Sheet, SheetHeader, SheetTitle, SheetDescription } from "@/components/ui/sheet"; <Sheet open={open} onOpenChange={setOpen} side="right"> <SheetHeader> <SheetTitle>Ticket Drawer</SheetTitle> <SheetDescription>Order overview.</SheetDescription> </SheetHeader></Sheet>Source code
sheet.tsx + 4 helpersZero third-party dependencies (5 local files shown in tabs below).
tsxsheet.tsx237 lines
"use client"; import * as React from "react";import { createPortal } from "react-dom";import { cn } from "./lib/utils";import { getFocusable, hideBackgroundSiblings, lockBodyScroll, registerEscapeLayer, trapFocus,} from "./lib/focus-trap";import { useIsMounted } from "./lib/react-compat";import { useControllableState } from "./lib/use-controllable-state"; interface SheetContextValue { titleId: string; descriptionId: string;Props
Interactive Prop Playground
Tweak parsed AST props below to generate ready-to-paste JSX.
tsx3 lines
import { Sheet } from "@/components/ui/sheet"; <Sheet />| Prop | Type | Description |
|---|---|---|
| open | boolean | Controlled open visibility state. |
| defaultOpen | boolean | Initial open state when uncontrolled. (Default: false) |
| onOpenChange | (open: boolean) => void | Callback invoked on open change. |
| side | "right" | "left" | "top" | "bottom" | Configures side. (Default: "right") |
| hideCloseButton | boolean | Toggles hide close button. (Default: false) |
| children | React.ReactNode | Child elements rendered inside the component. |
| className | string | Optional Tailwind or custom CSS classes merged with component styles. |
| aria-label | string | Configures aria label. |
| animated | boolean | Dual-mode: false renders instantly with no motion. Default true. |