Components

Sheet

The shadcn/ui Sheet (side drawer) with a short slide, dimmed backdrop and scrollable content — plus two animated React sheet blocks built with Motion and Radix: stacked sheets where the parent scales back as a new one opens, and a side panel you can drag closed.

  • Drop-in shadcn API
  • Four sides
  • Radix focus trap
  • Drag to close
  • Motion blocks

Installation

$ npx shadcn@latest add https://duskui.com/r/sheet.json

Replaces components/ui/sheet.tsx with the same exports and props (including side), so the shadcn Sidebar's mobile drawer keeps working. Adds an optional showCloseButton and exports SheetPortal / SheetOverlay. Animations are CSS (tw-animate-css), so the base needs no Motion.

Usage

filters-sheet.tsx
import { Button } from "@/components/ui/button"
import {
  Sheet,
  SheetContent,
  SheetDescription,
  SheetHeader,
  SheetTitle,
  SheetTrigger,
} from "@/components/ui/sheet"

export function FiltersSheet() {
  return (
    <Sheet>
      <SheetTrigger asChild>
        <Button variant="outline">Filters</Button>
      </SheetTrigger>
      <SheetContent side="left">
        <SheetHeader>
          <SheetTitle>Filters</SheetTitle>
          <SheetDescription>Narrow down the results.</SheetDescription>
        </SheetHeader>
        {/* … */}
      </SheetContent>
    </Sheet>
  )
}

Examples

Default

Slides in with a short ease-out over a dimmed backdrop and closes faster than it opened. The footer stays pinned to the bottom, long content scrolls inside the sheet, and the close button has proper hover and focus states.

Sides

Use side to slide in from top, right (default), bottom or left. Each side respects the safe-area inset on notched phones and casts its shadow away from its edge.

Blocks

Ready-made variations composed from the base component with Motion. Each installs on its own and pulls in its dependencies automatically.

Stacked Sheet

Nest a StackedSheet inside another one's content and the new sheet slides over it while the one underneath scales back, shifts aside and dims — three levels deep in this demo. Nested sheets get a back button, and closing one brings the sheet below forward again. Escape and outside clicks close only the top sheet.

$ npx shadcn@latest add https://duskui.com/r/stacked-sheet.json
PropTypeDefaultDescription
open / defaultOpen / onOpenChangeboolean / boolean / (open: boolean) => void—Open state (on StackedSheet).
side"right" | "left""right"Edge the sheets slide from. Nested sheets inherit it.
StackedSheetTrigger / StackedSheetCloseRadix Trigger / Close props—Use asChild to render your own Button.
title / descriptionReactNode—Accessible title and description (on StackedSheetContent).
footerReactNode—Actions pinned to the bottom (on StackedSheetContent).
showCloseButtonbooleantrueRender the X button (on StackedSheetContent).

Side Panel

A side sheet you can drag closed. Grab the edge handle or the header and pull toward the edge: a flick or a drag past closeThreshold dismisses it, anything less springs back, and the backdrop fades as you drag. The drag is a separate motion value from the slide-in, so the two never fight.

$ npx shadcn@latest add https://duskui.com/r/side-panel.json
PropTypeDefaultDescription
triggerReactElement—Element that opens the panel.
open / defaultOpen / onOpenChangeboolean / boolean / (open: boolean) => void—Open state.
title / descriptionReactNode—Accessible title and description.
children / footerReactNode—Scrollable body and pinned actions.
side"right" | "left""right"Edge the panel slides from and drags toward.
closeThresholdnumber0.35Fraction of the width it must be dragged to close.
showCloseButtonbooleantrueRender the X button.

API Reference

Same parts as shadcn/ui: Sheet, SheetTrigger, SheetClose, SheetContent, SheetHeader, SheetFooter, SheetTitle and SheetDescription, plus SheetPortal and SheetOverlay. Each forwards the Radix Dialog props.

PropTypeDefaultDescription
open / defaultOpen / onOpenChangeboolean / boolean / (open: boolean) => void—Open state (on Sheet).
side"top" | "right" | "bottom" | "left""right"Edge the sheet slides in from (on SheetContent).
showCloseButtonbooleantrueRender the X button (on SheetContent).
onOpenAutoFocus / onEscapeKeyDown / onPointerDownOutside(event) => void—Radix hooks; preventDefault() to customise (on SheetContent).

Accessibility

  • Built on Radix Dialog: role="dialog" with aria-modal, labelled by its title and described by its description.
  • Focus moves into the sheet, is trapped while it's open and returns to the trigger on close; the page behind can't scroll.
  • Escape, the backdrop and the close button close it. In Stacked Sheet they close only the top sheet, and nested sheets have a labelled Back button.
  • Side Panel's drag handle is a pointer enhancement — keyboard and screen reader users close it with Escape or the close button.
  • Under prefers-reduced-motion sheets fade instead of sliding, and stacked sheets don't scale.