BNA

BNA UI
26

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.

PropTypeDefaultDescription
childrenReactNode-The content to display inside the sheet.
styleViewStyle-Additional styles to apply to the content container.

SheetHeader

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

PropTypeDefaultDescription
childrenReactNode-The header content (title and description).
styleViewStyle-Additional styles to apply to the header.

SheetTitle

The title component for the sheet header.

PropTypeDefaultDescription
childrenReactNode-The title text or content.

SheetDescription

The description component for the sheet header.

PropTypeDefaultDescription
childrenReactNode-The 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

  • The sheet automatically handles safe area insets
  • 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