Sheet
A panel that slides in from an edge of the screen, in which users read details or complete a task.
A sheet slides a panel in from an edge of the screen, where users read details or complete a task without leaving the page. By default, it enters from the right edge and takes the full height of the screen. While it is open, focus stays in the sheet and the page behind it doesn't scroll. Users close it with the close button, the Escape key or a press outside the sheet.
Usage
Examples
Top Side
Content that relates to the entire page, such as the filters of a product list, can open from above. With side set to "top", the sheet slides down across the full width of the screen and takes only the height its content needs.
Bottom Side
On a phone, the lower edge of the screen lies within reach of the thumb, which suits short tasks such as choosing a store. Set to "bottom", side lets the sheet rise from that edge, again across the full width and only as tall as its content.
Left Side
Navigation and filters often sit at the left edge of a page, and a sheet that holds them appears where users already look for them. Through side set to "left", the sheet enters from that edge and takes the full height of the screen, as it does on the right.
With Footer
A sheet in which users complete a task ends with the actions that conclude it. Collected in SheetFooter, these actions follow everything users need to read before they decide. An action that abandons the task works through SheetClose, so it closes the sheet without further code.
Without Close Button
When the footer already offers a way to leave the task, a second close button only adds another choice. With showCloseButton set to false, the sheet leaves that button out, and users still close it through an action in the sheet, the Escape key or a press outside.
Controlled
The application sometimes decides when the sheet closes, for example only after a delivery has been booked into stock. Through open and onOpenChange it holds the open state, so an action inside the sheet closes it once its work is done, and any other part of the interface can open it.
Disabled Trigger
Details are not always available when users look for them, for example while a delivery still waits for its time slot. Marked as disabled, the trigger stays visible but no longer opens the sheet, so users know the details exist before they can read them.
Disabled Close
Closing a sheet can depend on the state of the task, for example when an action should end it only once every count has been entered. Once it carries disabled, SheetClose no longer closes the sheet, and users close it in the other ways instead.
API Reference
Sheet
| Prop | open |
|---|---|
| Type | boolean |
| Default | – |
| Description | Sets whether the sheet is open and makes it controlled. Update it in onOpenChange. |
| Prop | defaultOpen |
|---|---|
| Type | boolean |
| Default | false |
| Description | Opens the sheet at first render. The sheet then tracks its open state itself. |
| Prop | onOpenChange |
|---|---|
| Type | (open: boolean, eventDetails: DialogRootChangeEventDetails) => void |
| Default | – |
| Description | Runs when users open or close the sheet. It receives the open state that follows. |
| Prop | onOpenChangeComplete |
|---|---|
| Type | (open: boolean) => void |
| Default | – |
| Description | Runs after the sheet has opened or closed and its animations have finished. |
| Prop | modal |
|---|---|
| Type | boolean | "trap-focus" |
| Default | true |
| Description | Sets how the sheet limits the rest of the page while it is open. With true, focus stays in the sheet and the page doesn't scroll. With "trap-focus", focus stays in the sheet, but the page scrolls. With false, focus can move to the rest of the page, and the page scrolls. The overlay covers the page in each case. |
| Prop | disablePointerDismissal |
|---|---|
| Type | boolean |
| Default | false |
| Description | Keeps the sheet open when users press outside of it. A sheet with modal set to false then also stays open when focus moves outside of it. |
| Prop | triggerId |
|---|---|
| Type | string | null |
| Default | – |
| Description | Sets the ID of the trigger that a controlled sheet is associated with. A sheet without open doesn't need it. |
| Prop | defaultTriggerId |
|---|---|
| Type | string | null |
| Default | – |
| Description | Sets the ID of the trigger that the sheet is associated with when defaultOpen opens it at first render. |
| Prop | handle |
|---|---|
| Type | DialogHandle<Payload> |
| Default | – |
| Description | Connects the sheet with triggers that are rendered outside of it. Create the handle with Dialog.createHandle() from @base-ui/react/dialog. |
| Prop | actionsRef |
|---|---|
| Type | RefObject<DialogRootActions | null> |
| Default | – |
| Description | Receives the functions close and unmount. close closes the sheet from code, and unmount removes it from the DOM after a closing animation that the code controls itself. |
| Prop | children |
|---|---|
| Type | ReactNode | ((arg: { payload: Payload | undefined }) => ReactNode) |
| Default | – |
| Description | Holds the parts of the sheet. A function receives the payload of the trigger that opened the sheet. |
SheetTrigger
| Prop | handle |
|---|---|
| Type | DialogHandle<Payload> |
| Default | – |
| Description | Connects the trigger with a sheet that it is rendered outside of. Pass the same handle to Sheet. |
| Prop | payload |
|---|---|
| Type | Payload |
| Default | – |
| Description | Passes a value to the sheet when this trigger opens it. A function as children of Sheet receives it. |
| Prop | id |
|---|---|
| Type | string |
| Default | – |
| Description | Sets the ID of the trigger element. triggerId and defaultTriggerId of Sheet refer to it. |
| Prop | render |
|---|---|
| Type | ReactElement | render function |
| Default | – |
| Description | Replaces the native element or composes the trigger with another component. |
| Prop | nativeButton |
|---|---|
| Type | boolean |
| Default | true |
| Description | Declares whether the rendered element is a native button. Set it to false when render returns a different element. |
| Prop | disabled |
|---|---|
| Type | boolean |
| Default | false |
| Description | Prevents users from opening the sheet with this trigger. |
SheetContent
| Prop | side |
|---|---|
| Type | "top" | "right" | "bottom" | "left" |
| Default | "right" |
| Description | Sets the edge of the screen that the sheet slides in from. On the left and the right edge, the sheet takes the full height of the screen and three quarters of its width, at most 24rem from the sm breakpoint. On the top and the bottom edge, it takes the full width, and its height follows its content. |
| Prop | showCloseButton |
|---|---|
| Type | boolean |
| Default | true |
| Description | Shows the close button in the top right corner of the sheet. |
| Prop | initialFocus |
|---|---|
| Type | boolean | RefObject<HTMLElement | null> | ((openType: InteractionType) => boolean | HTMLElement | null | void) |
| Default | – |
| Description | Determines the element that receives focus when the sheet opens. Without it, focus moves to the first focusable element in the sheet, or to the sheet itself when users open it by touch. |
| Prop | finalFocus |
|---|---|
| Type | boolean | RefObject<HTMLElement | null> | ((closeType: InteractionType) => boolean | HTMLElement | null | void) |
| Default | – |
| Description | Determines the element that receives focus when the sheet closes. Without it, focus returns to the trigger or to the element that had focus before. |
| Prop | render |
|---|---|
| Type | ReactElement | render function |
| Default | – |
| Description | Replaces the native element or composes the content with another component. |
SheetHeader
SheetHeader groups the title and the description. It renders a div and has no props of its own.
SheetTitle
| Prop | render |
|---|---|
| Type | ReactElement | render function |
| Default | – |
| Description | Replaces the native element or composes the title with another component. |
SheetDescription
| Prop | render |
|---|---|
| Type | ReactElement | render function |
| Default | – |
| Description | Replaces the native element or composes the description with another component. |
SheetFooter
SheetFooter stacks the actions at the end of the sheet. It renders a div and has no props of its own.
SheetClose
| Prop | render |
|---|---|
| Type | ReactElement | render function |
| Default | – |
| Description | Replaces the native element or composes the close button with another component. |
| Prop | nativeButton |
|---|---|
| Type | boolean |
| Default | true |
| Description | Declares whether the rendered element is a native button. Set it to false when render returns a different element. |
| Prop | disabled |
|---|---|
| Type | boolean |
| Default | false |
| Description | Prevents users from closing the sheet with this button. |