Sheet
Present a focused drawer from a viewport edge.
Anatomy#
Content is portaled and renders inside the overlay element. With overlay={false}, that element is an unstyled wrapper without the overlay slot.
Usage#
Use Sheet for a focused drawer from a viewport edge, such as mobile navigation or an inspector. Sheet shares modal dismissal and focus behavior with Dialog.
- Use Drawer when the surface needs swipe-to-dismiss gestures or snap points.
- Use Dialog for a centered labeled task, or BaseDialog to compose backdrop and content yourself.
- Use Popover for anchored content that should not take over the page, or DropdownMenu for a compact action list.
Content composition#
Use Content title and description for simple cases:
For a custom header layout, compose the anatomy parts:
An explicit Sheet.Header replaces the header generated by Content’s title and description.
Sheet.Title and Sheet.Description connect their IDs to the surface’s accessible name and
description. Without a visible title, set aria-label or aria-labelledby on Content.
Sheet.Close is an explicit close control you can place inside the root; it is separate from
Content’s automatic corner close button:
closable={false}: hides the automatic corner close button.closeIcon: replaces the corner close button’s icon.translations: overrides thecloseaccessible label. See Localization.transition={false}: turns off enter and exit animations so content and overlay unmount as soon as the sheet closes.
Focus and dismissal#
modal defaults to true: focus stays inside the surface, outside content is hidden from assistive
technology, and native outside pointer actions are prevented. Closing restores focus to the trigger.
Use initialFocus to choose the element that receives focus on open (or false to skip the move)
and finalFocus to choose where focus returns. Both apply only while modal is true.
Setting modal={false} allows focus to leave the surface, but does not disable Escape or outside
dismissal:
closeOnOutsideClickandcloseOnEscape: control outside and Escape close requests (both default totrue).preventScroll: locks body scroll and defaults to the value ofmodal, so a non-modal surface leaves the page scrollable unlesspreventScrollis set.
Styling and portal#
Apply class and object style directly to each rendered part. Root classes and styles set
slot defaults for every part: trigger, overlay, content, header, title, description,
contentClose, body, and footer. See
Customization for precedence.
Set root mount to place Content in a chosen container. This also works for controlled
surfaces without a Trigger.
Side and layout#
Choose the viewport edge with root side (top, right, bottom, or left; default right), and set inset when the sheet needs space around it.
Compose body and footer regions to keep the task content separate from its actions.
State and dismissal#
Use controlled open state when a layout owns visibility. Disable normal dismissal only when the
sheet has a clear explicit close action; onClosePrevented receives blocked outside or Escape
attempts.
Keyboard interaction#
| Key | Description |
|---|---|
| Esc | Requests dismissal when closeOnEscape is not false. |
| ⇥ | Moves focus forward; modal sheets contain focus. |
| Shift + Tab | Moves focus backward; modal sheets contain focus. |
Examples#
Basic#
Place fields in the body and Cancel/Done in the footer. The default side is right.
Controlled#
A page button owns open. Closing from the footer reports back through onOpenChange.
Prevent dismissal#
closeOnOutsideClick={false} and closeOnEscape={false} block overlay click and Escape, and
onClosePrevented reports each blocked attempt. The footer action is the only way to close.
Sides#
Set side (left, right, top, or bottom) to anchor the sheet to any viewport edge.
API Reference#
Attributes#
data-closeddata-disableddata-expandeddata-overlay-scrolldata-transitiondata-headerProps#
Sheet#
Trigger#
Renders a <button> element by default.
Content#
Props for Sheet.Content. Renders a <div> element by default.
Header#
Renders a <div> element by default.
Title#
Renders a <h2> element by default.
Description#
Renders a <p> element by default.
Body#
Renders a <div> element by default.
Footer#
Renders a <div> element by default.