React bottom sheet
A bottom sheet slides up from the bottom edge, rests at chosen heights, and drags away to dismiss. scrollsheet is one in 14.4 kB compressed with no dependencies. This page is the shortest route from install to a sheet that works on a phone.
bun add scrollsheetA sheet with three stops
This is the whole component. The sheet opens at 35% of the viewport and drags to 70% or full height. The handle is a slider, so the arrow keys work too.
import { Sheet } from "scrollsheet";
import "scrollsheet/styles.css";
export function Filters() {
return (
<Sheet.Root detents={[0.35, 0.7, "full"]}>
<Sheet.Trigger>Filters</Sheet.Trigger>
<Sheet.Content>
<Sheet.Handle />
<Sheet.Title>Filters</Sheet.Title>
<Sheet.Description>Narrow the list by price and rating.</Sheet.Description>
<Sheet.Close>Done</Sheet.Close>
</Sheet.Content>
</Sheet.Root>
);
}The same three stops. Drag the sheet, or focus the handle and use the arrow keys.
What a phone-ready sheet has to get right
Dragging that the browser agrees with
scrollsheet puts the panel in a CSS scroll-snap container, so touch dragging is the browser's own scrolling with its own momentum. Mouse dragging on desktop uses pointer handlers.
Scrolling inside the sheet
A list inside a sheet competes with the sheet's own drag. Mark the list and the swipe goes to the list first, then to the sheet.
<Sheet.Content>
<div data-scrollsheet-nested-scroll style={{ overflowY: "auto", maxHeight: 300 }}>
{/* a long list */}
</div>
</Sheet.Content>The software keyboard
On iOS the keyboard covers the bottom of the page without resizing it. scrollsheet measures visualViewport and lifts bottom sheets above the keyboard on its own.
Focus and dismissal
Modal sheets are a native <dialog> opened with showModal(), so the browser contains focus, makes the page behind inert, and closes on Escape. Focus returns to the trigger when the sheet closes.
Sheets inside sheets
Render a Sheet.Root inside another sheet's content and the parent recedes behind it.
Open the second sheet. The first scales back and dims.
Other edges, and no modal at all
side takes any edge or "center". modal={false} leaves the page behind interactive, which suits a map with a results sheet.
Open the sheet, then pan the map behind it.
Which library
Four libraries cover most React bottom sheet needs, and the right one depends on what your app already ships.
- vaul: the most installed. Its README says the repo is unmaintained. scrollsheet's
Drawertakes common vaul props. - Base UI Drawer: maintained, unstyled, part of a larger component library. The Drawer shadcn/ui's Base UI flavour uses.
- react-modal-sheet: built on Motion, active, and lighter if Motion is already in your bundle.
- scrollsheet: no dependencies, native modal behavior, and the newest of the four. Dragging needs CSS scroll-snap, and browsers without
<dialog>get a static modal without dragging.
Radix Dialog is a dialog, not a sheet. That comparison covers when to keep it.
Questions
Which React bottom sheet library should I use?
It depends on what you already have. react-modal-sheet is a good fit if Motion is already in your app. vaul is the most installed, and its README says the repo is unmaintained. Base UI's Drawer is maintained and unstyled, and is what shadcn/ui's Base UI flavour uses. scrollsheet is the option with no dependencies and native modal behavior, and it is the youngest of the four. Each comparison page lists what scrollsheet does worse.
How do I add snap points to a React bottom sheet?
Pass detents to Sheet.Root: fractions of the viewport, pixel strings like "320px", or "content", "medium" and "full". The sheet rests at each stop and the handle moves between them with the arrow keys. See Detents.
How do I scroll a list inside a bottom sheet?
Add data-scrollsheet-nested-scroll to the scrolling element. A swipe scrolls the list first, and once the list is at its top the same swipe moves the sheet. See Scrollable content.
How do I stop the iOS keyboard from covering inputs in a sheet?
scrollsheet reads visualViewport and writes the keyboard inset to --scrollsheet-keyboard, so a bottom sheet moves above the keyboard with no prop. keyboardExpands promotes the sheet to its tallest detent while the keyboard is open. See Keyboard.
Does it work with Next.js?
Yes. Put 'use client' at the top of the file that renders Sheet.Root, as with any interactive component. See Framework support.