Sheet
The React Sheet component shows a panel that slides in from the edge of the screen. It is used to display extra content without leaving the current page.
It helps you show things like menus, forms, or details while keeping the main screen visible. For example, you can open a side panel to edit a profile or show navigation on mobile.
Built with React Aria and styled using Tailwind CSS. It supports accessibility and keyboard navigation, and it works well across different screen sizes.
Installation
Install the component using the Tailgrids CLI.
npx @tailgrids/cli add sheetAnatomy
The Sheet follows a composable pattern where each part can be styled and arranged manually.
import {
Sheet,
SheetTrigger,
SheetOverlay,
SheetContent,
SheetHeader,
SheetTitle,
SheetDescription,
SheetBody,
SheetFooter,
SheetClose
} from "@/registry/core/sheet";
export default function SheetAnatomy() {
return (
<Sheet>
<SheetTrigger />
<SheetOverlay>
<SheetContent side="right">
<SheetHeader>
<SheetTitle />
<SheetDescription />
</SheetHeader>
<SheetBody />
<SheetFooter>
<SheetClose />
</SheetFooter>
</SheetContent>
</SheetOverlay>
</Sheet>
);
}Usage
Create a sheet by composing the necessary components inside a root Sheet.
import {
Sheet,
SheetTrigger,
SheetOverlay,
SheetContent,
SheetHeader,
SheetTitle,
SheetDescription
} from "@/registry/core/sheet";
export default function SheetExample() {
return (
<Sheet>
<SheetTrigger>Open Sheet</SheetTrigger>
<SheetOverlay>
<SheetContent side="left">
<SheetHeader>
<SheetTitle>Menu</SheetTitle>
<SheetDescription>
Navigation for your application.
</SheetDescription>
</SheetHeader>
</SheetContent>
</SheetOverlay>
</Sheet>
);
}Examples
Custom Sides
The side prop on SheetContent allows you to control the entry point of the sheet. Options are top, right, bottom, and left.
Details Forms
Use sheets to display complex editing forms. This keeps the user on the same page while they perform focused tasks.
Mobile Navigation
A common use case for sheets is mobile menus. You can use close with render props to trigger navigation and close the sheet simultaneously.
Long Scrollable Content
Use SheetBody for content that might exceed the screen height. The body will automatically scroll while keeping the header and footer fixed if needed.
API Reference
Sheet
The root component that manages the open/close state of the sheet.
| Prop | Type | Default | Description |
|---|---|---|---|
children | React.ReactNode | - | The trigger and content elements |
isOpen | boolean | - | Controlled open state |
defaultOpen | boolean | - | Uncontrolled default open state |
onOpenChange | (isOpen: boolean) => void | - | Called when the open state changes |
SheetTrigger
The element that opens the sheet when pressed.
| Prop | Type | Default | Description |
|---|---|---|---|
children | React.ReactNode | - | The trigger label or element |
className | string | - | Additional CSS classes |
SheetOverlay
The backdrop overlay for the sheet. Wraps SheetContent and handles exit animations.
| Prop | Type | Default | Description |
|---|---|---|---|
children | React.ReactNode | - | The SheetContent element |
isDismissable | boolean | true | Whether clicking outside the sheet closes it |
className | string | - | Additional CSS classes for the overlay backdrop |
SheetContent
The primary layout component for the sheet panel.
| Prop | Type | Default | Description |
|---|---|---|---|
side | top | right | bottom | left | "right" | The edge of the screen the sheet slides from |
children | React.ReactNode | (opts: { close: () => void }) => React.ReactNode | - | Content of the sheet. Supports render props for close() access |
showCloseButton | boolean | true | Whether to show the default close button in the top-right |
modalProps | ModalProps | - | Props forwarded to the underlying Modal |
className | string | - | Additional CSS classes for the sheet panel |
See React Aria Modal API for more details on modalProps.
SheetHeader
A wrapper for the title and description at the top of the sheet.
| Prop | Type | Default | Description |
|---|---|---|---|
children | React.ReactNode | - | Header content |
className | string | - | Additional CSS classes |
SheetTitle
The accessible heading for the sheet.
| Prop | Type | Default | Description |
|---|---|---|---|
children | React.ReactNode | - | Title text |
className | string | - | Additional CSS classes |
SheetDescription
Secondary text for the sheet header.
| Prop | Type | Default | Description |
|---|---|---|---|
children | React.ReactNode | - | Description text |
className | string | - | Additional CSS classes |
SheetBody
A scrollable container for the main content of the sheet.
| Prop | Type | Default | Description |
|---|---|---|---|
children | React.ReactNode | - | Body content |
className | string | - | Additional CSS classes |
SheetFooter
An action bar section at the bottom of the sheet.
| Prop | Type | Default | Description |
|---|---|---|---|
children | React.ReactNode | - | Footer content |
showCloseButton | boolean | false | Whether to render a built-in "Close" button |
className | string | - | Additional CSS classes |
SheetClose
A specialized button with slot="close" that automatically closes the nearest sheet.
| Prop | Type | Default | Description |
|---|---|---|---|
children | React.ReactNode | - | The close button label/content |
className | string | - | Additional CSS classes |
Accessibility
- Semantic structure: The sheet appears as an overlay on top of the page, so screen readers treat it as a separate layer.
- Keyboard support: Users can close the sheet using the
Escapekey or the close button. - Focus management: Focus is trapped inside the sheet when open and returns to the trigger when it is closed.
- Trigger behavior: The sheet opens from a trigger element and supports custom trigger components.
- Screen reader support: The sheet title and description are announced clearly to explain the panel's purpose.
- Outside interaction: Clicking outside the sheet can close it when
dismissis enabled.
