Skip to content

Material 3

Components

Bottom sheet

Bottom sheets show secondary content anchored to the bottom of the screen.

Share
Edit name
Delete collection

Bottom sheets show secondary content anchored to the bottom of the screen. Use them in compact and medium windows.

A BottomSheet comes in two variants:

  • Standard (the default): The sheet stays at the bottom of the window while the page behind it remains in use. Use it for content that complements the screen's primary content, such as an audio player in a music app.
  • Modal, with isModal: The sheet opens in front of the page over a scrim and stays until it is closed. Use it as an alternative to an inline menu or a simple dialog on mobile, especially for a long list of actions, or for items that need longer descriptions and icons.

In expanded windows, use a side sheet instead.

A bottom sheet is composed of these parts:

PartUse
SheetTriggerThe trigger. Wraps the button that opens the sheet and the BottomSheet, with the button first. Without it, control the sheet with isOpen and onOpenChange.
BottomSheetThe sheet: a standard sheet (the default) or, with isModal, a modal sheet
import { BottomSheet, SheetTrigger } from '@material-web/react'

Basic bottom sheet

Wrap the button that opens the sheet and the sheet in a SheetTrigger. Write the sheet's content as its children. The sheet shows a drag handle above them, which hasDragHandle turns off. This sheet is a modal sheet.

import { BottomSheet, Button, Icon, List, ListItem, SheetTrigger } from '@material-web/react'
import { Text } from 'react-aria-components'

const actions = [
  ['Share', 'share'],
  ['Get link', 'link'],
  ['Edit name', 'edit'],
  ['Delete collection', 'delete'],
] as const

export default function Basic() {
  return (
    <SheetTrigger>
      <Button variant="tonal">Show actions</Button>
      <BottomSheet isModal aria-label="Collection actions">
        {({ state }) => (
          <List aria-label="Collection actions" className="pb-space-200">
            {actions.map(([name, icon]) => (
              <ListItem
                key={name}
                id={name}
                textValue={name}
                className="bg-transparent"
                onAction={() => state.close()}
              >
                <Icon slot="leading" name={icon} />
                <Text slot="label">{name}</Text>
              </ListItem>
            ))}
          </List>
        )}
      </BottomSheet>
    </SheetTrigger>
  )
}

Set isModal for a modal sheet. Without a trigger, control the sheet with isOpen and onOpenChange, or set defaultOpen to start with it open, as with React Aria's Sheet.

While a modal sheet is open, the page behind it cannot be used or scrolled, and the focus stays in the sheet. A menu in a modal sheet opens in front of it. Another dialog or modal sheet opened from it shows in front of it, and Escape closes the one in front.

Dismissal

A click on the scrim, Escape, a swipe down past where the sheet opened, and a press on the drag handle close a modal sheet. Set preventDismissal to turn all of these off. The drag handle is then decorative, and a button in the sheet with slot="close" still closes it.

import { BottomSheet, Button, SheetTrigger } from '@material-web/react'
import { Heading, Text } from 'react-aria-components'

export default function PreventDismissal() {
  return (
    <SheetTrigger>
      <Button variant="tonal">Discard draft</Button>
      <BottomSheet isModal preventDismissal role="alertdialog">
        <div className="flex flex-col gap-space-200 px-space-300 pb-space-300">
          <Heading slot="title" className="m-0 text-title-lg">
            Discard this draft?
          </Heading>
          <Text slot="description" className="text-on-surface-variant">
            What you have written so far is lost.
          </Text>
          <div className="flex justify-end gap-space-100">
            <Button variant="text" slot="close">
              Keep editing
            </Button>
            <Button slot="close">Discard</Button>
          </div>
        </div>
      </BottomSheet>
    </SheetTrigger>
  )
}

The sheet in this example has role="alertdialog" in place of the default dialog, and a Text in the description slot describes it.

To close the sheet from your own code, such as when an item is chosen, pass a function as the sheet's children and call state.close().

To decide for each press outside the sheet whether it closes the sheet, pass a function as shouldCloseOnInteractOutside. It receives the pressed element, and the sheet stays open when it returns false.

Standard bottom sheet

Without isModal, a sheet is a standard sheet. It is fixed to the bottom of the window with no scrim, and the page behind it still scrolls and takes clicks. Leave room at the end of the page for the part of the sheet that shows.

A standard sheet shows unless isOpen is false. Pass onOpenChange to let it be dismissed: a swipe down or a scroll up that takes the sheet out of sight, Escape in the sheet, a press on the drag handle at the sheet's full height, and a button with slot="close" each call onOpenChange with false. The sheet stays until you set isOpen to false. Without onOpenChange, the sheet rests no lower than its lowest snap point, and Escape and a button with slot="close" do nothing in it.

When a standard sheet is shown, the focus moves to its drag handle, or to the first focusable element in it when it has no drag handle. Tab then moves the focus out to the page. When the sheet is hidden, the focus returns to where it was.

Name a standard sheet with an aria-label, or with a Heading from react-aria-components in the title slot.

In this example, a swipe down, Escape in the sheet, or the drag handle at its full height dismisses the sheet.

Nothing is playing
import { BottomSheet, Button, Icon, IconButton, List, ListItem } from '@material-web/react'
import { useState } from 'react'
import { UNSAFE_PortalProvider } from 'react-aria'
import { Text } from 'react-aria-components'

const queue = ['Strangers', 'Slow Mornings', 'Tape Hiss', 'Last Train Home', 'Blue Hour']

export default function Standard() {
  // The box stands in for the window: the sheet is rendered in it, and fixed to it.
  const [screen, setScreen] = useState<HTMLElement | null>(null)
  const [isOpen, setOpen] = useState(false)
  return (
    <div
      ref={setScreen}
      className="@container relative h-120 w-full overflow-clip bg-surface contain-layout"
    >
      <div className="flex flex-col items-center gap-space-200 p-space-300">
        <span className="text-body-lg text-on-surface-variant">
          {isOpen ? 'Swipe the player down to dismiss it' : 'Nothing is playing'}
        </span>
        <Button variant="tonal" isDisabled={isOpen} onPress={() => setOpen(true)}>
          Play something
        </Button>
      </div>
      <UNSAFE_PortalProvider getContainer={() => screen}>
        <BottomSheet
          aria-label="Now playing"
          snapPoints={[112]}
          isOpen={isOpen}
          onOpenChange={setOpen}
        >
          <div className="flex h-16 shrink-0 items-center ps-space-300 pe-space-100">
            <span className="grow truncate text-body-lg">Cassette Futurism</span>
            <IconButton aria-label="Pause">
              <Icon name="pause" />
            </IconButton>
            <IconButton aria-label="Next">
              <Icon name="skip_next" />
            </IconButton>
          </div>
          <List aria-label="Up next" className="overflow-y-auto pb-space-200">
            {queue.map((title) => (
              <ListItem key={title} id={title} textValue={title} className="bg-transparent">
                <Icon slot="leading" name="music_note" />
                <Text slot="label">{title}</Text>
              </ListItem>
            ))}
          </List>
        </BottomSheet>
      </UNSAFE_PortalProvider>
    </div>
  )
}

Note: The standard sheet examples on this page render the sheet in a box that stands in for the window. The box is the container of an UNSAFE_PortalProvider from react-aria and has contain-layout. In an app, write the sheet without either.

Slots

  1. title
  2. description
  3. close
SlotChildUse
titleA HeadingNames the sheet. It is a level 2 heading unless you set its level.
descriptionA Text, in a modal sheetDescribes the sheet
closeAny buttonCloses the sheet after its own onPress

Note: A Heading or a button with a slot the sheet does not have throws an Invalid slot error, as in a React Aria Dialog.

Drag handle

A sheet shows a drag handle at its top: a button named "Drag handle". Set dragHandleLabel to name it in another language.

A click, Space or Enter on the drag handle closes a modal sheet. On a standard sheet, it raises the sheet to the next of its snapPoints up, or else to its full height. At the full height, it dismisses a sheet that has an onOpenChange, and lowers any other to its lowest snap point.

Set hasDragHandle={false} to leave the drag handle out. A sheet without one can still be swiped, and a modal sheet is still closed by its scrim and Escape. Give such a modal sheet an action that closes it, as in this example. Give a sheet with more than one height and no drag handle your own action that changes its height.

import {
  BottomSheet,
  Button,
  Divider,
  Icon,
  List,
  ListItem,
  SheetTrigger,
} from '@material-web/react'
import { Heading, Text } from 'react-aria-components'

const orders = [
  ['Name', 'sort_by_alpha'],
  ['Last modified', 'schedule'],
  ['Size', 'straighten'],
] as const

export default function WithoutDragHandle() {
  return (
    <SheetTrigger>
      <Button variant="tonal">Sort files</Button>
      <BottomSheet isModal hasDragHandle={false} className="pt-space-300">
        {({ state }) => (
          <>
            <Heading slot="title" className="m-0 px-space-200 pb-space-100 text-title-lg">
              Sort by
            </Heading>
            <List aria-label="Sort by">
              {orders.map(([name, icon]) => (
                <ListItem
                  key={name}
                  id={name}
                  textValue={name}
                  className="bg-transparent"
                  onAction={() => state.close()}
                >
                  <Icon slot="leading" name={icon} />
                  <Text slot="label">{name}</Text>
                </ListItem>
              ))}
            </List>
            <Divider />
            <div className="flex justify-end p-space-200">
              <Button variant="text" slot="close">
                Cancel
              </Button>
            </div>
          </>
        )}
      </BottomSheet>
    </SheetTrigger>
  )
}

Swiping

A sheet moves between its heights in these ways:

  • Swipe: A finger swipes the sheet anywhere on it: up to raise it, and down to lower it once the content under the finger is scrolled to its top.
  • Wheel: Scrolling down over a partially expanded sheet raises it. Scrolling up at the sheet's full height, once the content is at its top, lowers the sheet to its snap point, and scrolling further closes a modal sheet.
  • Focus: Moving the focus to an element below the part of the sheet that shows raises it.
  • Mouse or pen: A mouse or a pen drags the sheet by its drag handle.

A sheet let go part way settles at the nearer of its heights, or at the next one in the direction of a fast drag.

Snap points

Set snapPoints to the heights at which a sheet rests partially expanded, as with React Aria's snap points. Each one is how much of the sheet shows: a number in pixels, or a length, where a percentage is of the sheet's own height. The sheet also rests at its full height. A sheet no taller than a snap point is at its full height there.

  • A modal sheet opens at the first snap point, half the window's height by default.
  • A standard sheet is shown at the first snap point, 56dp by default. Its drag handle raises it to the next snap point up.
  • Set snapPoints={[]} to keep a sheet at its full height.

At its full height, the sheet has data-expanded. In this example, the sheet rests with its headline showing, at half of its height, and at its full height.

import { BottomSheet, Button, Icon, List, ListItem } from '@material-web/react'
import { useState } from 'react'
import { UNSAFE_PortalProvider } from 'react-aria'
import { Heading, Text } from 'react-aria-components'

const stops = ['Union Square', 'Market Street', 'Civic Center', 'Mission', 'Glen Park', 'Daly City']

export default function SnapPoints() {
  // The box stands in for the window: the sheet is rendered in it, and fixed to it.
  const [screen, setScreen] = useState<HTMLElement | null>(null)
  const [isOpen, setOpen] = useState(false)
  return (
    <div
      ref={setScreen}
      className="@container relative h-120 w-full overflow-clip bg-surface contain-layout"
    >
      <div className="flex justify-center p-space-300">
        <Button variant="tonal" isDisabled={isOpen} onPress={() => setOpen(true)}>
          Show the route
        </Button>
      </div>
      <UNSAFE_PortalProvider getContainer={() => screen}>
        <BottomSheet snapPoints={[104, '50%']} isOpen={isOpen} onOpenChange={setOpen}>
          <Heading slot="title" className="m-0 shrink-0 px-space-300 pb-space-200 text-title-lg">
            6 stops, 24 min
          </Heading>
          <List aria-label="Stops" className="overflow-y-auto pb-space-200">
            {stops.map((stop) => (
              <ListItem key={stop} id={stop} textValue={stop} className="bg-transparent">
                <Icon slot="leading" name="train" />
                <Text slot="label">{stop}</Text>
              </ListItem>
            ))}
          </List>
        </BottomSheet>
      </UNSAFE_PortalProvider>
    </div>
  )
}

Expanded state

A standard sheet keeps track of whether it is at its full height. Set defaultExpanded to start at the full height each time the sheet is shown, or control it with isExpanded and onExpandedChange, for example from your own collapse button. onExpandedChange is called once a swipe, the wheel, the drag handle or a focus move has raised or lowered the sheet. A controlled sheet stays at the height isExpanded sets until you change it.

import { BottomSheet, Button, Icon, IconButton, List, ListItem } from '@material-web/react'
import { useState } from 'react'
import { UNSAFE_PortalProvider } from 'react-aria'
import { Heading, Text } from 'react-aria-components'

const queue = ['Strangers', 'Slow Mornings', 'Tape Hiss', 'Last Train Home', 'Blue Hour']

export default function Expanded() {
  // The box stands in for the window: the sheet is rendered in it, and fixed to it.
  const [screen, setScreen] = useState<HTMLElement | null>(null)
  const [isOpen, setOpen] = useState(false)
  const [isExpanded, setExpanded] = useState(false)
  return (
    <div
      ref={setScreen}
      className="@container relative h-120 w-full overflow-clip bg-surface contain-layout"
    >
      <div className="flex justify-center gap-space-100 p-space-300">
        <Button variant="tonal" isDisabled={isOpen} onPress={() => setOpen(true)}>
          Show the queue
        </Button>
        <Button variant="outlined" isDisabled={!isOpen} onPress={() => setExpanded(!isExpanded)}>
          {isExpanded ? 'Collapse' : 'Expand'}
        </Button>
      </div>
      <UNSAFE_PortalProvider getContainer={() => screen}>
        <BottomSheet
          snapPoints={[104]}
          isOpen={isOpen}
          onOpenChange={setOpen}
          isExpanded={isExpanded}
          onExpandedChange={setExpanded}
        >
          <div className="flex shrink-0 items-center ps-space-300 pe-space-100 pb-space-100">
            <Heading slot="title" className="m-0 grow text-title-lg">
              Up next
            </Heading>
            <IconButton
              aria-label={isExpanded ? 'Collapse' : 'Expand'}
              onPress={() => setExpanded(!isExpanded)}
            >
              <Icon name={isExpanded ? 'keyboard_arrow_down' : 'keyboard_arrow_up'} />
            </IconButton>
          </div>
          <List aria-label="Up next" className="overflow-y-auto pb-space-200">
            {queue.map((title) => (
              <ListItem key={title} id={title} textValue={title} className="bg-transparent">
                <Icon slot="leading" name="music_note" />
                <Text slot="label">{title}</Text>
              </ListItem>
            ))}
          </List>
        </BottomSheet>
      </UNSAFE_PortalProvider>
    </div>
  )
}

Size and scrolling

A sheet is as tall as its content, up to 72dp short of the top of the window. It spans the window up to 640dp wide. In a window wider than 640dp, it keeps 56dp from each side and from the top.

  • Set className="max-w-none" to remove the 640dp limit.
  • Add a bottom-sheet-top-* class to set how far short of the top of the window the sheet is at its full height, in place of 72dp and 56dp, for example to keep it under an app's top bar. The value is a number on Tailwind's spacing scale (bottom-sheet-top-29), a spacing token or any length.

The sheet's content is laid out in a column below the drag handle. Give the element that should scroll, such as a list, overflow-y-auto: it shrinks to fit and scrolls, and what is above it stays in place. When no element scrolls, the whole content scrolls below the drag handle. The content scrolls only when the sheet is at its full height. Below that, a swipe or the wheel raises the sheet.

A modal sheet taller than half the window opens with half the window's height showing. A swipe up, a scroll down over the sheet, or moving the focus to an item below the fold raises it to its full height, where its list scrolls.

import { BottomSheet, Button, Icon, List, ListItem, SheetTrigger } from '@material-web/react'
import { Text } from 'react-aria-components'

const files = [
  'Budget 2026',
  'Cover letter',
  'Design review',
  'Expenses',
  'Floor plan',
  'Flight tickets',
  'Holiday photos',
  'Invoice 0043',
  'Meeting notes',
  'Moodboard',
  'Onboarding',
  'Packing list',
  'Quarterly report',
  'Recipes',
  'Roadmap',
  'Site survey',
  'Team offsite',
  'Travel budget',
]

export default function Scrolling() {
  return (
    <SheetTrigger>
      <Button variant="tonal">Choose a file</Button>
      <BottomSheet isModal aria-label="Files">
        {({ state }) => (
          <List aria-label="Files" className="overflow-y-auto pb-space-200">
            {files.map((name) => (
              <ListItem
                key={name}
                id={name}
                textValue={name}
                className="bg-transparent"
                onAction={() => state.close()}
              >
                <Icon slot="leading" name="description" />
                <Text slot="label">{name}</Text>
              </ListItem>
            ))}
          </List>
        )}
      </BottomSheet>
    </SheetTrigger>
  )
}

Full-screen

Set isFullScreen to make a standard sheet full-screen at its full height. Such a sheet is always as tall as its full height, whatever its content. While it is full-screen, its fill covers everything above it, up to the top of the window, and the bar of its drag handle is hidden. The drag handle stays in the tab order and shows its bar while it has the keyboard focus.

The sheet stops being full-screen as soon as a swipe moves it down, and is full-screen again once a swipe up brings it back near its full height. While it is full-screen, the sheet has data-full-screen. Target it to restyle what is above the sheet, such as an app's search bar.

A full-screen sheet has no collapse button. Add your own, such as an icon button in an app bar at the top of the sheet, and control the sheet with isExpanded.

import { BottomSheet, Button } from '@material-web/react'
import { useState } from 'react'
import { UNSAFE_PortalProvider } from 'react-aria'
import { Heading } from 'react-aria-components'

const places = [
  ['Mud Island Amphitheater', 'Outdoor seasonal theater · 0.6 mi'],
  ['Overton Park Shell', 'Amphitheater · 1.2 mi'],
  ['Crosstown Concourse', 'Shopping center · 2.1 mi'],
  ['Shelby Farms Park', 'Park · 9.4 mi'],
] as const

export default function FullScreen() {
  // The box stands in for the window: the sheet is rendered in it, and fixed to it.
  const [screen, setScreen] = useState<HTMLElement | null>(null)
  const [isOpen, setOpen] = useState(false)
  return (
    <div
      ref={setScreen}
      className="@container relative h-120 w-full overflow-clip bg-surface-container contain-layout"
    >
      <div className="flex justify-center p-space-300">
        <Button variant="tonal" isDisabled={isOpen} onPress={() => setOpen(true)}>
          Explore the area
        </Button>
      </div>
      <UNSAFE_PortalProvider getContainer={() => screen}>
        <BottomSheet isFullScreen snapPoints={[200]} isOpen={isOpen} onOpenChange={setOpen}>
          <Heading slot="title" className="m-0 px-space-300 pb-space-200 text-title-lg">
            Latest in the area
          </Heading>
          {places.map(([name, about]) => (
            <div key={name} className="flex flex-col px-space-300 py-space-150">
              <span className="text-title-sm">{name}</span>
              <span className="text-body-sm text-on-surface-variant">{about}</span>
            </div>
          ))}
        </BottomSheet>
      </UNSAFE_PortalProvider>
    </div>
  )
}

Customization

Pass classes in className to restyle one sheet. className, style and ref apply to the sheet's container. See Styling for the classes, the states and the theme.

  • States: While a standard sheet appears and leaves, it has data-entering and data-exiting. See States.
  • Functions: className, style and children can be functions of the sheet's state, on a standard sheet and a modal one alike: state, whose close() closes the sheet, isEntering, isExiting, isExpanded (true at the sheet's full height), position, swipeDirection, stackIndex and hasDescendants. See Children as a function.
  • Ancestors: A bottom sheet of either variant is rendered at the end of the page, not inside the element it is written in. A class or a data-theme on an element around it does not reach it: set it on the BottomSheet itself, or on the root element. See Theme.
  • Attributes: A BottomSheet also takes attributes and events of its <div>, such as id and onClick.

Limitations

isFullScreen, isExpanded, defaultExpanded and onExpandedChange have no effect on a modal sheet.

Variant changes

Changing isModal while a sheet is shown remounts its content, so the content's scroll position and state are lost.