Sheets
Bottom and side sheets for supplementary content, modal or standing in the layout.
import { BottomSheet, SideSheet, SheetTrigger } from '@windmorph/react';Props
BottomSheet 22 props
modalopens over a scrim as a dialog that blocks the page;standardsits over the page without a scrim, so both can be used at once, and rests collapsed atpeekHeightor expanded (detent).Whether the sheet is open (controlled).
Whether the sheet starts open when uncontrolled.
Show the drag handle. Without it, the top 48px of the sheet still drags.
Whether dragging the handle, the top of the sheet or (touch and pen) its content moves the sheet. Without it the handle stays a button (a press, Enter or Space), and Escape, the scrim and the close button work as before.
Open fully instead of to half the window when the content is taller than half the window (modal).
Height of a collapsed standard sheet, px. While collapsed, the content's top-level parts that don't fit entirely in it are
inert.Where a standard sheet rests (controlled):
collapsedatpeekHeightorexpandedto its full height, so the app can raise or lower it ("can be set by the system or toggled by the user", m3.material.io). Its handle, a drag, Escape and its collapse button then only callonDetentChange. A modal sheet ignores it.Where a standard sheet first rests when uncontrolled;
expandedopens it fully raised (ComposerememberStandardBottomSheetState(initialValue = SheetValue.Expanded)). It applies each time the sheet opens. A modal sheet ignores it.How the user can close a modal sheet, as HTML's
<dialog closedby>:any(Escape, a press on the scrim or a drag down),closerequest(Escape or a drag down) ornone(only its buttons or the app).While the sheet fills the window height, show a close button (modal) or a collapse button (standard) at its top end.
Replaces the close button's icon.
Replaces the collapse button's icon.
Ref to the panel, the sheet's surface (
role="dialog").
Events
Called when the sheet opens or closes.
Called when a standard sheet moves to another detent: by its handle (a press, Enter or Space, or a drag), Escape or its collapse button. Not called for a modal sheet.
Text
Words the sheet announces, with English defaults. A
LabelsProvidersets them for the whole app.The drag handle while the sheet is half open or collapsed (it expands the sheet).
The drag handle and collapse button of a fully open standard sheet.
The drag handle of a fully open modal sheet (it closes the sheet).
The close button of a modal sheet that fills the window height.
Accessible name when there's no visible title. Required without
aria-labelledby.Id of the visible title that names the sheet. Required without
aria-label.
Classes for each part, by slot.
The outermost element, which places the sheet (where
classNameandstylego too):fixedto the window's bottom by default, or, for example,absoluteto a region.The dimmed layer behind a modal sheet.
The sheet's surface: its colour, corners and shadow.
The drag handle's 48px pressable area.
The drag handle's visible bar, inside
handle.The row holding the close (modal) or collapse (standard) button.
The close or collapse icon button.
The scrollable content area.
Goes with
styleon the outermost element, the container that places the sheet, so a layout class (absolute,fixed, a transform) moves the whole sheet and never clips or stretches its surface. Style the surface withclassNames.panel;ref,data-*and other attributes go on the panel.Goes on the outermost element, with
className.
Also accepts the root element's HTML attributes (id, data-*, event handlers).
SideSheet 23 props
modalopens over a scrim as a dialog;standardsits in the layout beside the content and opens and closes its width.Float 16px from the edges with corners all round.
The window edge the sheet is anchored to:
end(the right in a left-to-right page, the left in RTL, as M3 asks) orstart. A modal sheet slides in from it and swipes out toward it; a standard sheet faces it, with its divider on the other side. The root'sdata-edgesays which.Whether a touch or pen swipe toward the sheet's edge closes a modal sheet (past half its width, or a fling). The close button, Escape and the scrim still close it either way, and a mouse drag never moves it. Off when
closedByis"none"; a standard sheet ignores it. To keep the sheet open after a swipe (unsaved changes), controlopenand leave ittrue: the sheet springs back.Whether the sheet is open (controlled).
Whether the sheet starts open when uncontrolled.
The headline. It names the sheet.
One of
title,aria-labeloraria-labelledbyis required.Header controls before the close button.
A divider between a standard sheet and the content beside it.
How the user can close a modal sheet, as HTML's
<dialog closedby>:any(Escape, a press on the scrim or a swipe),closerequest(Escape or a swipe) ornone(only its buttons or the app).Replaces the close button's icon.
Replaces the back button's icon.
Ref to the panel, the sheet's surface (
role="dialog"); a standard sheet's outer box.
Events
Called when the sheet opens or closes.
Shows a back button before the title, for a sheet with several levels.
Text
Words the sheet announces, with English defaults. A
LabelsProvidersets them for the whole app.Accessible name when there's no visible title; overrides
titlewhen both are set.Id of a visible element that names the sheet, when there's no
title.
Classes for each part, by slot.
The outermost element, which places the sheet (where
classNameandstylego too): a modal sheet's boxfixedto the window'sedge, or a standard sheet's layout box.The dimmed layer behind a modal sheet.
The box around a standard sheet's surface, which holds a detached sheet's margins.
The sheet's surface: its colour, corners, width and shadow.
The header row: back button, title, actions and close button.
The back button.
The headline.
The end of the header:
actionsand the close button.The close button.
The scrollable content area.
Goes with
styleon the outermost element, the box that places the sheet, so a layout class moves the whole sheet and never clips or stretches its surface. Style the surface withclassNames.panel;ref,data-*and other attributes go on the panel (a standard sheet's are on its outer box).Goes on the outermost element, with
className.
Also accepts the root element's HTML attributes (id, data-*, event handlers).
SheetTrigger 4 props
The trigger (a library button) followed by a
BottomSheetor modalSideSheet.Whether the sheet is open (controlled).
Whether the sheet starts open when uncontrolled.
Tokens
M3's component tokens as CSS variables. Each is unset until you set it, on :root, a theme or any ancestor, and falls back to the default shown. The root carries data-variant (and data-size where it has sizes), which picks the variables that apply. See Component tokens in the Customisation guide.
| Variable | Default | Paints | Compose |
|---|---|---|---|
--md-comp-sheet-bottom-docked-container-color | var(--md-sys-color-surface-container-low) | The sheet. | SheetBottomTokens.DockedContainerColor |
--md-comp-sheet-bottom-docked-container-shape | var(--md-sys-shape-corner-extra-large) | The sheet's top corners. | SheetBottomTokens.DockedContainerShape |
--md-comp-sheet-bottom-docked-drag-handle-color | var(--md-sys-color-on-surface-variant) | The drag handle. | SheetBottomTokens.DockedDragHandleColor |
| Modal (variant) | |||
--md-comp-sheet-bottom-docked-modal-container-elevation | var(--md-sys-elevation-level-1) | The shadow of a modal sheet. | SheetBottomTokens.DockedModalContainerElevation |
| Standard (variant) | |||
--md-comp-sheet-bottom-docked-standard-container-elevation | var(--md-sys-elevation-level-1) | The shadow of a standard sheet. | SheetBottomTokens.DockedStandardContainerElevation |
| Variable | Default | Paints | Compose |
|---|---|---|---|
| Modal (variant) | |||
--md-comp-sheet-side-docked-modal-container-color | var(--md-sys-color-surface-container-low) | A modal sheet. | m3_comp_sheet_side_docked_modal_container_color |
--md-comp-sheet-side-docked-modal-container-elevation | var(--md-sys-elevation-level-1) | The shadow of a modal sheet. | m3_comp_sheet_side_docked_modal_container_elevation |
--md-comp-sheet-side-docked-modal-container-shape | var(--md-sys-shape-corner-large) | A docked modal sheet's corners on its free edge. | m3_comp_sheet_side_docked_modal_container_shape |
| Standard (variant) | |||
--md-comp-sheet-side-docked-standard-container-color | var(--md-sys-color-surface) | A standard sheet, beside the content. | m3_comp_sheet_side_docked_standard_container_color |
| True (detached) | |||
--md-comp-sheet-side-detached-container-shape | var(--md-sys-shape-corner-large) | A detached sheet's corners, all round. | m3_comp_sheet_side_detached_container_shape |
Spec status
Built to the M3 Expressive sheets spec. Each item of its variants and configurations links to a live example; where the M3 Expressive column of the spec differs from the original M3 one, it wins.
| Item | Status | Details |
|---|---|---|
| Standard bottom sheet | Built | Variant · Bottom standard |
| Modal bottom sheet | Built | Variant · Bottom |
| Standard side sheet | Built | Variant · Standard |
| Modal side sheet | Built | Variant · Side |
| Drag handle (optional) | Built | Configuration · Bottom, Bottom standard |
| Expanded and collapsed states | Built | Configuration · Bottom detents |
| Detached side sheet | Built | Configuration · Side levels |
| Side sheet bottom actions | Built | Configuration · Side |
| Back navigation in a side sheet | Built | Use case · Side levels |
| Side sheet on either edge (usually the right, mirrored in RTL) | Built | Configuration · Side edge, Side |
| Escape on a modal bottom sheet | Differs | Escape closes a modal sheet in one press, as a close request closes a modal dialog on the web (WAI-ARIA APG), where Compose's back press first returns a fully open sheet to half. Drags and the handle still stop at half. |
| Skip the half detent | Extension | skipPartiallyExpanded opens a tall modal sheet fully, as Compose's sheet state can. |
| Swipe to dismiss a modal side sheet | Extension | A touch or pen swipe toward the sheet's edge closes it past half its width or on a fling, as Material Components Android's modal side sheet can be dragged off the screen; the M3 web guidance doesn't describe it. swipeable={false} turns it off. |
| Turn dragging off | Extension | swipeable={false} on either sheet, as Compose's sheetGesturesEnabled = false; a bottom sheet's handle stays a button. |
| Predictive back | Not built | The predictive back gesture isn't built. Nested scrolling is: an upward swipe on a half-open sheet's content raises the sheet first and then scrolls the content, and a downward drag on content scrolled to its top moves the sheet. |
| More detents | Not built | Sheets settle at half or full (modal) and peek or full (standard) only. |
Standard bottom sheet
BuiltVariant · Bottom standard
Modal bottom sheet
BuiltVariant · Bottom
Standard side sheet
BuiltVariant · Standard
Modal side sheet
BuiltVariant · Side
Drag handle (optional)
BuiltConfiguration · Bottom, Bottom standard
Expanded and collapsed states
BuiltConfiguration · Bottom detents
Detached side sheet
BuiltConfiguration · Side levels
Side sheet bottom actions
BuiltConfiguration · Side
Back navigation in a side sheet
BuiltUse case · Side levels
Escape on a modal bottom sheet
DiffersEscape closes a modal sheet in one press, as a close request closes a modal dialog on the web (WAI-ARIA APG), where Compose's back press first returns a fully open sheet to half. Drags and the handle still stop at half.
Skip the half detent
ExtensionskipPartiallyExpandedopens a tall modal sheet fully, as Compose's sheet state can.Swipe to dismiss a modal side sheet
ExtensionA touch or pen swipe toward the sheet's edge closes it past half its width or on a fling, as Material Components Android's modal side sheet can be dragged off the screen; the M3 web guidance doesn't describe it.
swipeable={false}turns it off.Turn dragging off
Extensionswipeable={false}on either sheet, as Compose'ssheetGesturesEnabled = false; a bottom sheet's handle stays a button.Predictive back
Not builtThe predictive back gesture isn't built. Nested scrolling is: an upward swipe on a half-open sheet's content raises the sheet first and then scrolls the content, and a downward drag on content scrolled to its top moves the sheet.
More detents
Not builtSheets settle at half or full (modal) and peek or full (standard) only.
Bundle size
Gzipped, as published: the component and the library code it imports. React, React Aria, Motion and the other dependencies aren't counted, and your bundler's minifier makes it smaller still. CI fails a change that grows it past its budget.
BottomSheet: 43.8 kBSideSheet: 42.2 kBSheetTrigger: 1.0 kB
M3 Expressive specs
- Shape
bottom: rounded-corner-extra-large (top corners) · side: rounded-corner-large- Variants
modal, standard- Elevation
level1 · standard side sheet: level0
Differences from Compose
- Bottom sheet values follow m3.material.io and Compose (
ModalBottomSheet.kt,SheetDefaults.kt): up to 640px wide, a 72px top margin (56px, with 56px side margins, above 640px), 28px top corners,surface-container-lowat level 1, a 32×4px handle and a 32% scrim; it shows on the default spatial spring and hides on the fast spatial spring, moving 112% of its size so the spring's overshoot stays out of view. A standard sheet peeks 56px by default, as Compose'sBottomSheetScaffolddoes. - Detents follow Compose's legacy anchors — half the window when taller, else full;
skipPartiallyExpandedopens fully. Dragging and settling port Compose'sAnchoredDraggableStaterules. As with Compose's nested scrolling, an upward swipe on a half-open sheet's content raises the sheet first and then scrolls the content. Moving down to a lower detent (Escape, the handle, the collapse button) runs on the fast effects spring, so it never drops below the detent; a drag's settle keeps the spatial spring and starts at the speed the sheet was let go with, as Compose's does. - Side sheets aren't in Compose; their values follow m3.material.io and Material Components Android (256px wide and at most 400px, 16px corners on the free edge, standard sheets open and close their measured width, behind an
outline-variantdivider, and closing one with focus inside returns focus to where it came from; a 72px bottom action row fromfooter). Their content scrolls vertically only: anything wider than the sheet is clipped (m3.material.io: “Side sheets cannot scroll horizontally”).edgefollows Material Components Android'sstart/endsheet edge, and swiping a modal side sheet off its edge follows its modal side sheet; the settle uses Compose's anchored-drag rules with half the width as the threshold, as Compose's horizontalModalWideNavigationRaildoes. There is noconfirmValueChange: a controlledopenis the veto for every way of closing. - Not yet supported: predictive back, and detents beyond half / full (modal) or peek / full (standard).