ValyroUI Русская версия

Bottom Sheet

iOS-style bottom sheet: snap points, swipe, peek mode. Free, MIT · Overlays and notifications › Dialogs and panels

iOS-style sheet with snap points. Drag the handle, header or (at lower heights) the content; a flick moves on to the next height or closes it. The content scrolls only at the highest snap point, and pulling down from its top drags the sheet again.

Installation

npx valyro-cli@latest add bottom-sheet
npx shadcn@latest add https://valyro.xyz/r/bottom-sheet.json
npm install valyro-ui

import 'valyro-ui/styles.css';
import { BottomSheet } from 'valyro-ui';

Props

PropTypeDefault
openbooleanControlled open; use with onOpenChange.
defaultOpenbooleanfalseInitial open when uncontrolled.
onOpenChange(open: boolean) => voidCalled with the new open when it changes.
snapPointsSnapPoint[]['50%', '92%']Heights the sheet rests at, lowest first: px (320 or '320px') or a share of the available height ('50%'). Default ['50%', '92%'] — iOS medium and large detents.
snapnumberIndex of the current snap point (controlled).
defaultSnapnumber0Snap point the sheet opens at (default 0, the lowest).
onSnapChange(index: number) => voidCalled with the new snap when it changes.
modalbooleantruetrue (default): backdrop, focus trap, page scroll lock. false: a "peek" sheet that leaves the page interactive, like the drawer of a maps app.
dismissiblebooleantrueCan be closed by dragging below the lowest snap point, Escape or a backdrop press (default true).
dimFromnumber0Snap index at which the backdrop is fully dimmed; it fades in below that (default 0).
titleReactNodeHeading in the draggable header; also the dialog's accessible name.
descriptionReactNodeText under the title; also the dialog's accessible description.
showHandlebooleantrueShow the grab handle (default true).
containerHTMLElement | nullRender inside this element (which should be position: relative; overflow: hidden) instead of over the viewport — for sheets inside a panel, map or device frame.
initialFocusRefRefObject<HTMLElement | null>Element focused when a modal sheet opens (default: the sheet itself).
labelsPartial<BottomSheetLabels>Overrides for the built-in English text; keys left out keep their defaults.
childrenReactNodeSheet body; it scrolls only at the highest snap point, otherwise dragging it moves the sheet. In the compound form, a BottomSheet.Trigger and a BottomSheet.Content (with .Header, .Title, .Description, .Body, .Close).

Compound parts

BottomSheet.Trigger (BottomSheetTrigger), BottomSheet.Content (BottomSheetContent), BottomSheet.Header (BottomSheetHeader), BottomSheet.Title (BottomSheetTitle), BottomSheet.Description (BottomSheetDescription), BottomSheet.Body (BottomSheetBody), BottomSheet.Close (BottomSheetClose)

Related components

Previous: Drawer · Next: Popover · All Overlays and notifications