Skip to main content
A sheet component that slides in from the edges of the screen, ideal for sidebars, settings panels, and detail views.

Installation

npm install @kuzenbo/core

Usage

Basic Example

import { Sheet, Button } from "@kuzenbo/core";

export default function SheetExample() {
  return (
    <Sheet>
      <Sheet.Trigger render={<Button variant="outline" />}>
        Open customer profile
      </Sheet.Trigger>
      <Sheet.Content side="right">
        <Sheet.Header>
          <Sheet.Title>Customer profile</Sheet.Title>
          <Sheet.Description>
            Review lifecycle details before escalating a support ticket.
          </Sheet.Description>
        </Sheet.Header>
        <Sheet.Footer>
          <Sheet.Close render={<Button variant="outline" />}>Close</Sheet.Close>
          <Button>Escalate case</Button>
        </Sheet.Footer>
      </Sheet.Content>
    </Sheet>
  );
}

Left Side Sheet

import { Sheet, Button } from "@kuzenbo/core";

export default function LeftSheetExample() {
  return (
    <Sheet>
      <Sheet.Trigger render={<Button variant="outline" />}>
        Open navigation
      </Sheet.Trigger>
      <Sheet.Content side="left">
        <Sheet.Header>
          <Sheet.Title>Navigation</Sheet.Title>
        </Sheet.Header>
      </Sheet.Content>
    </Sheet>
  );
}

Composed Anatomy

import { Sheet, Button } from "@kuzenbo/core";

export default function ComposedSheet() {
  return (
    <Sheet>
      <Sheet.Trigger render={<Button variant="outline" />}>
        Open panel
      </Sheet.Trigger>
      <Sheet.Portal>
        <Sheet.Backdrop />
        <Sheet.Viewport>
          <Sheet.Popup side="right">
            <Sheet.Header>
              <Sheet.Title>Panel title</Sheet.Title>
              <Sheet.Description>
                Panel description.
              </Sheet.Description>
            </Sheet.Header>
            <Sheet.Footer>
              <Sheet.Close render={<Button variant="outline" />}>
                Close
              </Sheet.Close>
              <Button>Save</Button>
            </Sheet.Footer>
          </Sheet.Popup>
        </Sheet.Viewport>
      </Sheet.Portal>
    </Sheet>
  );
}

Without Close Button

import { Sheet, Button } from "@kuzenbo/core";

export default function SheetWithoutClose() {
  return (
    <Sheet>
      <Sheet.Trigger render={<Button variant="outline" />}>
        Open form
      </Sheet.Trigger>
      <Sheet.Content side="right" showCloseButton={false}>
        <Sheet.Header>
          <Sheet.Title>Edit settings</Sheet.Title>
        </Sheet.Header>
        <Sheet.Footer>
          <Sheet.Close render={<Button variant="outline" />}>
            Cancel
          </Sheet.Close>
          <Button>Save changes</Button>
        </Sheet.Footer>
      </Sheet.Content>
    </Sheet>
  );
}

API Reference

Sheet (Root)

defaultOpen
boolean
The initial open state when uncontrolled.
open
boolean
The controlled open state of the sheet.
onOpenChange
(open: boolean) => void
Callback fired when the open state changes.

Sheet.Content

side
'top' | 'right' | 'bottom' | 'left'
default:"'right'"
The side from which the sheet slides in.
showCloseButton
boolean
default:"true"
Whether to display the close button in the top-right corner.
className
string
Additional CSS classes to apply to the sheet popup.

Sheet.Popup

side
'top' | 'right' | 'bottom' | 'left'
default:"'right'"
The side from which the sheet slides in.
className
string
Additional CSS classes to apply.

Sheet.Trigger

render
ReactElement
The element to render as the trigger. Uses Base UI render composition.

Sheet.Title

children
ReactNode
The title content for the sheet.

Sheet.Description

children
ReactNode
The description content for the sheet.

Sheet.Header

children
ReactNode
The header content, typically contains Title and Description.
children
ReactNode
The footer content, typically contains action buttons.

Sheet.Close

render
ReactElement
The element to render as the close trigger.

Component Parts

The Sheet component is built from several composable parts:
  • Sheet - Root component that manages state
  • Sheet.Trigger - Opens the sheet
  • Sheet.Portal - Portals the sheet content to document.body
  • Sheet.Backdrop - The overlay backdrop
  • Sheet.Viewport - Positions the sheet
  • Sheet.Popup - The sheet container with slide animation
  • Sheet.Content - Convenience wrapper that includes Portal, Backdrop, Viewport, and Popup
  • Sheet.Header - Styled header container
  • Sheet.Title - Accessible title
  • Sheet.Description - Accessible description
  • Sheet.Footer - Styled footer container
  • Sheet.Close - Closes the sheet
  • Sheet.Overlay - Alternative backdrop component

Accessibility

  • Sheet implements the WAI-ARIA Dialog pattern
  • Focus is trapped within the sheet when open
  • Pressing Escape closes the sheet
  • Focus returns to the trigger element when closed
  • Title and Description are automatically linked for screen readers

Build docs developers (and LLMs) love