Sheets
Bottom sheets with detents, a grabber, drag and swipe to dismiss with a spring, scrolling that expands the sheet, dimming, and confirming unsaved changes — built on dialog.
Apple's definition: "A sheet helps people perform a scoped task that's closely related to their current context" — pick a delivery time, share a link, attach a file — and return to where they were. On iPhone it rises from the bottom, rests at one or more heights, and goes away with a swipe down.
Open the delivery picker, drag the sheet, scroll the list, change the slot and try to swipe it away:
Detents
A detent is a height where the sheet rests. iOS defines two: "large is the height of a fully expanded sheet and medium is about half of the fully expanded height." Apple's advice on choosing:
- Medium and large for progressive disclosure — the share sheet shows the most relevant items at medium, and people expand it for more.
- Large only when the content needs the room — Messages and Mail compose sheets "display only at full height".
At large, the screen behind shrinks slightly and rounds its corners, so the sheet reads as a layer on top rather than a new screen. In the demo that's a transform on the app root, driven by the same spring value as the sheet, so it only kicks in between medium and large.
Dragging and settling
The sheet follows the finger and settles at a detent when released, with the same rule as swipe back:
- A flick (faster than ~600 px/s) goes to the next detent in its direction — down from medium dismisses, up from medium expands.
- A slow release goes to the nearest detent.
- Past large, the drag is damped to a third of the finger's movement, the rubber band that says "this is as far as it goes".
The settle is a spring that starts at the release speed — the velocity hand-off from the Motion page — so there's no seam between the finger letting go and the animation taking over. A drag only starts after the pointer has moved a few pixels, and only then captures the pointer — "capture only after winning" from the Gestures page: capturing on press would send the click that follows a tap to the header instead of Cancel, Done or the grabber.
The grabber
"A grabber shows people that they can drag the sheet to resize it; they can
also tap it to cycle through the detents." It's also the accessible way to
resize: "a grabber also works with VoiceOver so people can resize the sheet
without seeing the screen." On the web that means a real <button> with a
label that says what it will do:
<button
type="button"
aria-label={detent === "medium" ? "Expand sheet" : "Shrink sheet"}
onClick={() => goTo(detent === "medium" ? "large" : "medium")}
>
<span className="grabber" />
</button>Scrolling expands the sheet
When a sheet can still grow, scrolling its content grows the sheet first. UIKit's default: "scrolling up in the sheet increases its detent instead of scrolling the sheet's content. After the sheet reaches its largest detent, scrolling begins." At large, the reverse hand-off applies: pulling down while the content is at its top drags the sheet down instead of bouncing the list.
It's the conditional hand-off tactic —
nested scrolling, in Android's terms — and on the web it takes three input
paths. Because touch-action can't change once a touch has started, it's
set from the detent before the touch begins:
- Touch at medium: the content has
touch-action: noneandoverflow: hidden, so every drag moves the sheet. - Touch at large: the content scrolls natively (
touch-action: pan-y). A non-passivetouchmovelistener watches for a downward pull whilescrollTopis 0, and only then callspreventDefault()and moves the sheet. It has to be a native listener — React's touch handlers are passive. - Mouse wheel at medium: a non-passive
wheellistener expands to large instead of scrolling.
content.addEventListener(
"touchmove",
(event) => {
if (detent !== "large") return;
const y = event.touches[0].clientY;
if (!pulling) {
if (content.scrollTop > 0 || y - startY < 6) return;
pulling = true;
beginDrag(y);
}
event.preventDefault();
moveDrag(y);
},
{ passive: false },
);Dimming
By default iOS dims the screen behind the sheet at every detent, and the
dimmed area doesn't respond to taps. largestUndimmedDetentIdentifier
changes that: set to medium, the sheet dims only at large, and "the undimmed
area around the sheet responds to user interaction, allowing for a nonmodal
experience" — Maps, or Notes' formatting sheet. Tick the checkbox above the
demo: at medium the checkout behind stays usable, and the sheet stops being
modal (aria-modal, inert on the app root) until it's expanded.
Dismissing with unsaved changes
"People expect to swipe vertically to dismiss a sheet instead of tapping a dismiss button. If people have unsaved changes in the sheet when they begin swiping to dismiss it, use an action sheet to let them confirm their action." The demo springs back to medium and asks; Cancel and Escape do the same.
The buttons follow Apple's layout: Cancel at the leading edge of the top bar, Done at the trailing edge, Done disabled until something changed. Apple warns against a Done button on its own — "relying solely on the Done button implies that completing the task is the only way to exit the sheet".
Building it on dialog
A modal sheet is a dialog, and <dialog> opened with showModal() gives you
most of the hard parts for free:
- everything outside it is inert — no clicks, no focus, hidden from screen readers;
- focus moves into it, and returns to the trigger when it closes;
- Escape, and the back gesture on Android, close it — both arrive as a "close request";
::backdropis the dimming layer.
For the unsaved-changes check, close through requestClose() (Baseline 2025) rather than close(): it fires cancel first, exactly like Escape and
the back gesture, so one handler covers all three:
dialog.addEventListener("cancel", (event) => {
if (!hasUnsavedChanges()) return;
event.preventDefault();
showDiscardConfirmation();
});
swipeDismiss.onDismiss = () => dialog.requestClose();
cancelButton.onclick = () => dialog.requestClose();closedby controls which requests count: any (also light dismiss by
clicking the backdrop), closerequest (Escape and back, the default for
showModal()), or none.
The demo opens a non-modal <dialog open> and handles inertness, focus and
Escape itself, because it switches between modal and non-modal at the medium
detent when the checkbox is on — something showModal() can't do without
closing and reopening. A sheet that is always modal should use showModal().
Or use a library
Everything above is a fair amount of code to keep working on real phones. The libraries we tried:
| Library | Native feel as shipped | Accessible as shipped | Status |
|---|---|---|---|
| react-modal-sheet | detents, iOS modal effect, scroll + snap handling; settles with a 0.2 s tween | no | maintained |
| Base UI Drawer | snap points and swipe; no scroll hand-off; CSS transitions | yes (built on Dialog) | maintained |
| Vaul | close to iOS; CSS transitions | yes (built on Radix) | "This repo is unmaintained" |
None of them carries the release speed into the settle animation: they use
the speed to pick a detent, then animate with a fixed curve. react-modal-sheet
is the closest to iOS behaviour but "doesn't include any built-in
accessibility properties" — its guide shows how to add them with React Aria
(useDialog, FocusScope, useOverlay, useModal). Base UI's Drawer is
the accessible, maintained choice, at the cost of some iOS behaviour.
Reduced motion
With prefers-reduced-motion: reduce, the spring jumps straight to each
detent — the sheet and the scaled screen behind it change at once. Dragging
still works: it follows the finger, which is motion the user is causing
rather than motion they receive.
Sources
- Apple Human Interface Guidelines: Sheets
- Apple UIKit:
largestUndimmedDetentIdentifier,prefersScrollingExpandsWhenScrolledToEdge,prefersGrabberVisible - MDN:
<dialog>,HTMLDialogElement.requestClose(),CloseWatcher - Libraries: react-modal-sheet, Base UI Drawer, Vaul