Ambient UI

Command Palette

Search for a command to run...

Sheet

Extends the dialog component to display content that slides in from the edge of the screen.

Usage

import { Sheet } from "@smartacteam/ambient-web/sheet";
<Sheet.Root>
  <Sheet.Trigger>Open</Sheet.Trigger>
  <Sheet.Content>
    <Sheet.Header>
      <Sheet.Title>Sheet Title</Sheet.Title>
      <Sheet.Description>Sheet description goes here.</Sheet.Description>
    </Sheet.Header>
    <div>Sheet content</div>
    <Sheet.Footer>
      <Sheet.Close>Close</Sheet.Close>
    </Sheet.Footer>
  </Sheet.Content>
</Sheet.Root>

Examples

Side Variants

The sheet can slide in from any edge of the screen. Use the side prop on Sheet.Content to control the direction.

<Sheet.Content side="right"> {/* default */}
<Sheet.Content side="left">
<Sheet.Content side="top">
<Sheet.Content side="bottom">

Content API Reference

PropTypeDefault
side"top" | "right" | "bottom" | "left""right"
showCloseButtonbooleantrue

Design Notes

The sheet component:

  • Positioning: Full height/width on the edge specified by the side prop
  • Width: 75% on mobile, max 28rem (sm:max-w-lg) on desktop for left/right sides
  • Height: Auto with max 85vh for top/bottom sides
  • Animation: Slides in/out from the specified edge with 200ms duration, starting from 10% off-screen
  • Border: Single border on the edge opposite to the slide direction
  • Rounding: Rounded on corners opposite to the edge
  • Close button: Positioned in top-right for most sides, bottom-right for bottom sheets

Layout Pattern

The sheet uses a flexbox column layout to ensure proper spacing:

  • Content: Provides consistent padding (p-6) and uses flex flex-col to stack children
  • Header: Includes bottom padding (pb-4) to separate from content
  • Body content: Add vertical padding (py-4) to your content wrapper for proper spacing
  • Footer: Includes top padding (pt-4) and mt-auto to stick to the bottom
<Sheet.Content>
  <Sheet.Header>{/* pb-4 applied automatically */}</Sheet.Header>
  <div className="py-4">{/* Your content with vertical spacing */}</div>
  <Sheet.Footer>{/* pt-4 and mt-auto applied automatically */}</Sheet.Footer>
</Sheet.Content>

The component uses the same design tokens as Dialog for consistency (surface-50, border-stroke, shadow-lg).

Customizing Animation

The sheet uses a fixed 10% slide distance defined in the component source. To customize the animation distance, modify the arbitrary value in sheet.tsx:

// Example: Change from 10% to 20%
"slide-in-from-right-[20%]";
"slide-out-to-right-[20%]";

The default 10% creates a subtle slide effect while still being clearly visible to users.