Skip to content

Sheets

Bottom and side sheets for supplementary content, modal or standing in the layout.

import { BottomSheet, SideSheet, SheetTrigger } from '@windmorph/react';

Props

By name or description, across the 49 props below

BottomSheet 22 props

  • varianttype "modal" | "standard"default "modal"

    modal opens over a scrim as a dialog that blocks the page; standard sits over the page without a scrim, so both can be used at once, and rests collapsed at peekHeight or expanded (detent).

  • opentype boolean

    Whether the sheet is open (controlled).

  • defaultOpentype booleandefault false, or true when standard

    Whether the sheet starts open when uncontrolled.

  • dragHandletype booleandefault true

    Show the drag handle. Without it, the top 48px of the sheet still drags.

  • swipeabletype booleandefault true

    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.

  • skipPartiallyExpandedtype booleandefault false

    Open fully instead of to half the window when the content is taller than half the window (modal).

  • peekHeighttype numberdefault 56

    Height of a collapsed standard sheet, px. While collapsed, the content's top-level parts that don't fit entirely in it are inert.

  • detenttype "collapsed" | "expanded"

    Where a standard sheet rests (controlled): collapsed at peekHeight or expanded to 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 call onDetentChange. A modal sheet ignores it.

  • defaultDetenttype "collapsed" | "expanded"default "collapsed"

    Where a standard sheet first rests when uncontrolled; expanded opens it fully raised (Compose rememberStandardBottomSheetState(initialValue = SheetValue.Expanded)). It applies each time the sheet opens. A modal sheet ignores it.

  • closedBytype "any" | "closerequest" | "none"default "any"

    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) or none (only its buttons or the app).

  • closeButtontype booleandefault true

    While the sheet fills the window height, show a close button (modal) or a collapse button (standard) at its top end.

  • closeIcontype ReactElement<unknown, string | JSXElementConstructor<any>>

    Replaces the close button's icon.

  • collapseIcontype ReactElement<unknown, string | JSXElementConstructor<any>>

    Replaces the collapse button's icon.

  • reftype Ref<HTMLDivElement>

    Ref to the panel, the sheet's surface (role="dialog").

Events

  • onOpenChangetype ((open: boolean) => void)

    Called when the sheet opens or closes.

  • onDetentChangetype ((detent: BottomSheetDetent) => void)

    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

  • labelstype Partial<BottomSheetLabels>

    Words the sheet announces, with English defaults. A LabelsProvider sets them for the whole app.

  • aria-labeltype string

    Accessible name when there's no visible title. Required without aria-labelledby.

  • aria-labelledbytype string

    Id of the visible title that names the sheet. Required without aria-label.

Also accepts the root element's HTML attributes (id, data-*, event handlers).

SideSheet 23 props

  • varianttype "modal" | "standard"default "modal"

    modal opens over a scrim as a dialog; standard sits in the layout beside the content and opens and closes its width.

  • detachedtype booleandefault false

    Float 16px from the edges with corners all round.

  • edgetype "start" | "end"default "end"

    The window edge the sheet is anchored to: end (the right in a left-to-right page, the left in RTL, as M3 asks) or start. 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's data-edge says which.

  • swipeabletype booleandefault true

    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 closedBy is "none"; a standard sheet ignores it. To keep the sheet open after a swipe (unsaved changes), control open and leave it true: the sheet springs back.

  • opentype boolean

    Whether the sheet is open (controlled).

  • defaultOpentype booleandefault false, or true when standard

    Whether the sheet starts open when uncontrolled.

  • titletype ReactNode

    The headline. It names the sheet.

    One of title, aria-label or aria-labelledby is required.

  • actionstype ReactNode | ((props: SideSheetRenderProps) => ReactNode)

    Header controls before the close button.

  • footerDividertype booleandefault false

    A divider between the content and footer.

  • dividertype booleandefault true

    A divider between a standard sheet and the content beside it.

  • closedBytype "any" | "closerequest" | "none"default "any"

    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) or none (only its buttons or the app).

  • closeIcontype ReactElement<unknown, string | JSXElementConstructor<any>>

    Replaces the close button's icon.

  • backIcontype ReactElement<unknown, string | JSXElementConstructor<any>>

    Replaces the back button's icon.

  • reftype Ref<HTMLDivElement>

    Ref to the panel, the sheet's surface (role="dialog"); a standard sheet's outer box.

Events

  • onOpenChangetype ((open: boolean) => void)

    Called when the sheet opens or closes.

  • onBacktype (() => void)

    Shows a back button before the title, for a sheet with several levels.

Text

  • labelstype Partial<SideSheetLabels>

    Words the sheet announces, with English defaults. A LabelsProvider sets them for the whole app.

  • aria-labeltype string

    Accessible name when there's no visible title; overrides title when both are set.

  • aria-labelledbytype string

    Id of a visible element that names the sheet, when there's no title.

Also accepts the root element's HTML attributes (id, data-*, event handlers).

SheetTrigger 4 props

  • childrentype ReactNodeRequired

    The trigger (a library button) followed by a BottomSheet or modal SideSheet.

  • opentype boolean

    Whether the sheet is open (controlled).

  • defaultOpentype booleandefault false

    Whether the sheet starts open when uncontrolled.

Events

  • onOpenChangetype ((open: boolean) => void)

    Called when the sheet opens or closes.

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.

Sheets tokens (md-comp-sheet-bottom-docked)
VariableDefaultPaintsCompose
--md-comp-sheet-bottom-docked-container-colorvar(--md-sys-color-surface-container-low)The sheet.SheetBottomTokens.DockedContainerColor
--md-comp-sheet-bottom-docked-container-shapevar(--md-sys-shape-corner-extra-large)The sheet's top corners.SheetBottomTokens.DockedContainerShape
--md-comp-sheet-bottom-docked-drag-handle-colorvar(--md-sys-color-on-surface-variant)The drag handle.SheetBottomTokens.DockedDragHandleColor
Modal (variant)
--md-comp-sheet-bottom-docked-modal-container-elevationvar(--md-sys-elevation-level-1)The shadow of a modal sheet.SheetBottomTokens.DockedModalContainerElevation
Standard (variant)
--md-comp-sheet-bottom-docked-standard-container-elevationvar(--md-sys-elevation-level-1)The shadow of a standard sheet.SheetBottomTokens.DockedStandardContainerElevation
Sheets tokens (md-comp-sheet-side)
VariableDefaultPaintsCompose
Modal (variant)
--md-comp-sheet-side-docked-modal-container-colorvar(--md-sys-color-surface-container-low)A modal sheet.m3_comp_sheet_side_docked_modal_container_color
--md-comp-sheet-side-docked-modal-container-elevationvar(--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-shapevar(--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-colorvar(--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-shapevar(--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.

  • 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.

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 kB
  • SideSheet: 42.2 kB
  • SheetTrigger: 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-low at 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's BottomSheetScaffold does.
  • Detents follow Compose's legacy anchors — half the window when taller, else full; skipPartiallyExpanded opens fully. Dragging and settling port Compose's AnchoredDraggableState rules. 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-variant divider, and closing one with focus inside returns focus to where it came from; a 72px bottom action row from footer). Their content scrolls vertically only: anything wider than the sheet is clipped (m3.material.io: “Side sheets cannot scroll horizontally”). edge follows Material Components Android's start / end sheet 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 horizontal ModalWideNavigationRail does. There is no confirmValueChange: a controlled open is the veto for every way of closing.
  • Not yet supported: predictive back, and detents beyond half / full (modal) or peek / full (standard).