Componentfeedback1.77 KB gzipZero dependencies

Sheet

Slide-over drawer panel with focus trap and scroll lock.

Preview

Live Preview
Open ↗

Installation

Tokens guide →

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

npx bigbullui add sheet

Or install the full npm package:

npm install bigbullui

Usage

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 helpers

Zero 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 />
PropTypeDescription
openbooleanControlled open visibility state.
defaultOpenbooleanInitial open state when uncontrolled. (Default: false)
onOpenChange(open: boolean) => voidCallback invoked on open change.
side"right" | "left" | "top" | "bottom"Configures side. (Default: "right")
hideCloseButtonbooleanToggles hide close button. (Default: false)
childrenReact.ReactNodeChild elements rendered inside the component.
classNamestringOptional Tailwind or custom CSS classes merged with component styles.
aria-labelstringConfigures aria label.
animatedbooleanDual-mode: false renders instantly with no motion. Default true.