Sheet

PreviousNext

A modal component that slides in from the side of the screen, commonly used for navigation menus, filters, and detail views.

Installation

pnpm dlx bna-ui add sheet

Usage

import {
  Sheet,
  SheetContent,
  SheetDescription,
  SheetHeader,
  SheetTitle,
  SheetTrigger,
} from '@/components/ui/sheet';
<Sheet>
  <SheetTrigger>
    <Button>Open Sheet</Button>
  </SheetTrigger>
  <SheetContent>
    <SheetHeader>
      <SheetTitle>Sheet Title</SheetTitle>
      <SheetDescription>
        This is a description of the sheet content.
      </SheetDescription>
    </SheetHeader>
    {/* Your content here */}
  </SheetContent>
</Sheet>

Examples

Default

Left Side

Form Sheet

Filter Sheet

API Reference

Sheet

The root component that manages the sheet state and provides context to child components.

PropTypeDefaultDescription
openboolean-Controls whether the sheet is open or closed.
onOpenChange(open: boolean) => void-Callback fired when the sheet state changes.
side'left' | 'right''right'The side from which the sheet slides in.
childrenReactNode-The sheet trigger and content components.

SheetTrigger

The trigger component that opens the sheet when pressed.

PropTypeDefaultDescription
childrenReactNode-The trigger content (usually a button or text).
asChildbooleanfalseWhether to render as a child component.

SheetContent

The main content container that slides in from the specified side.

PropTypeDescription
childrenReactNodeThe content to display inside the sheet.
styleViewStyleAdditional styles to apply to the content container.

SheetHeader

A header component that provides consistent spacing and layout for the sheet title and description.

PropTypeDescription
childrenReactNodeThe header content (title and description).
styleViewStyleAdditional styles to apply to the header.

SheetTitle

The title component for the sheet header.

PropTypeDescription
childrenReactNodeThe title text or content.

SheetDescription

The description component for the sheet header.

PropTypeDescription
childrenReactNodeThe description text or content.

Accessibility

The Sheet component is built with accessibility in mind:

  • Uses native Modal component for proper focus management
  • Includes proper ARIA attributes for screen readers
  • Supports keyboard navigation and dismissal
  • Close button is positioned for easy access
  • Overlay can be pressed to dismiss the sheet
  • Proper hit areas for touch targets

Animation

The Sheet component includes smooth animations:

  • Slides in from the specified side (left or right)
  • Fades in the overlay backdrop
  • Animates out when dismissed
  • Uses native animations for optimal performance

Notes

  • Maximum width is set to 80% of screen width or 400px, whichever is smaller
  • Includes platform-specific shadow styling for iOS and Android
  • Close button position adapts based on the sheet side