How it works
Position is the distance of the panel top below the highest snap point, written to transform every frame while dragging, so React never re-renders. At rest the panel height equals the snap height; during a gesture it is stretched to full height and compensated with translateY, then shrunk once settled. The footer stays pinned to the visible bottom. On release the last 100ms of velocity decides a one-step flick, and the snap curve is built from that velocity so motion continues smoothly. Only the handle area drags; content keeps native scrolling. The backdrop dims and lightly blurs the page behind (override with --ds-sheet-backdrop); the panel is a borderless card with 28px top corners and a soft upward shadow, and the footer has no divider.
Use it for
- Mobile choices that keep people on the current page: payment method, options, coupons.
- Action menus such as share and more.
- Detail panels over a map or list: half open to peek, pull up for everything.
Look elsewhere when
- Desktop: use a centered dialog or a side drawer; a bottom sheet is too far from the eyes on large screens.
- Dangerous confirmations that must be handled, such as deleting an account: use a centered dialog that is harder to dismiss by mistake.
- Long content that needs its own browsing: open a new page.
Usage
import { useState } from 'react'
import { BottomSheet } from './BottomSheet.jsx'
export function BuyButton() {
const [open, setOpen] = useState(false)
return (
<>
<button onClick={() => setOpen(true)}>Buy now</button>
<BottomSheet
open={open}
onClose={() => setOpen(false)}
title="Choose payment method"
snapPoints={[0.8, 0.96]}
footer={<button onClick={() => setOpen(false)}>Pay $25.60</button>}
>
<PaymentMethodList />
</BottomSheet>
</>
)
}Props
| Prop | Type | Default | What it does |
|---|---|---|---|
open | boolean | — | Whether the sheet is open. |
onClose | () => void | — | Requests closing (pull down, backdrop click, Esc). You set open to false; if you do not, the sheet springs back. |
title | ReactNode | — | Title, also the dialog's accessible name (aria-labelledby). |
footer | ReactNode | — | Action area pinned to the bottom, visible at every snap height. |
snapPoints | number[] | [0.5, 0.9] | Snap points as fractions of the container height. A single value means a fixed height. |
defaultSnap | number | 0 | Index (low to high) of the snap point to open at. |
onSnapChange | (index: number) => void | — | Called when the snap point changes. |
closeThreshold | number | 0.25 | Releasing after pulling down more than the lowest snap height times this fraction closes the sheet. |
velocityThreshold | number | 0.5 | Release speed (px/ms) above which a drag counts as a flick. |
dismissible | boolean | true | Whether pulling down, a backdrop click and Esc can close it. When false, pulling down also resists. |
contained | boolean | false | Confines the sheet to the nearest positioned ancestor (absolute). By default it is portaled to the body and fills the viewport. |
initialFocusRef | RefObject<HTMLElement> | — | Element to focus first after opening. Defaults to the panel itself. |
labels | object | — | Replaces built-in text (lowerSheet, raiseSheet), the handle button's names. Shallow-merged over the English defaults. |
children | ReactNode | — | Content; it scrolls inside the content area when too tall. |
...rest | HTMLAttributes<HTMLDivElement> | — | Other attributes go to the panel (the role=dialog element), such as aria-label and className. |
Accessibility
- The panel is role="dialog" with aria-modal="true" and its title linked by aria-labelledby.
- Focus moves into the panel (or initialFocusRef) on open, Tab cycles inside it, and focus returns to the opener on close.
- While open, siblings are inert: unreadable, unreachable by Tab and not clickable; outside contained mode, page scrolling is locked.
- Esc closes; the handle is a real button: Enter and Space switch snap points, Up and Down move one step, and the hit area is 44px.
- Reduced motion makes opening, closing and snapping jump into place while dragging still follows the finger.
Motion
Open 300ms ease-out, close 200ms ease-in, handle snap 320ms ease-in-out. Release snaps take 200 to 400ms by distance on a curve built from the release velocity. The dimmed, blurred backdrop follows the same curve. Reduced motion jumps into place.
Add it to your project
Pro members copy a prompt and their coding agent installs the source, the same way as the free components.
BottomSheet.jsxbottom-sheet.csstokens.cssREADME.md
Both files install together. The stylesheet reads the design tokens in tokens.css and carries fallbacks, so it also works alone.

