Skip to content

API

Tap a stop button or drag the handle to try the props below.

Prop Type Default
open boolean controlled
defaultOpen boolean false
onOpenChange (open: boolean) => void
onOpenChangeComplete (open: boolean) => void fires when the transition visually finishes
actionsRef React.Ref<SheetActions> open() / close() / snapTo(detent)
Prop Type Default
detents readonly DetentSpec[] ['content']
activeDetent DetentSpec first entry in detents, or 'content' if empty
onActiveDetentChange (detent: DetentSpec) => void
sequentialDetents boolean false
flick 'step' | 'project' 'project'

flick decides where a fast release lands. 'project' carries the velocity forward, so one flick can cross several detents. 'step' lands on the next detent past where you let go, the way Apple’s sheets do. Speed alone can dismiss only from the first detent; from a higher one, the release has to be under closeThreshold. A slow release settles on the nearest detent either way.

Prop Type Default
dismissible boolean true
escapeDismissible boolean dismissible
backdropDismissible boolean dismissible
closeThreshold number (0-1) 0.5

closeThreshold is the fraction of the first detent that must stay visible on release. Below it, the release dismisses, so a higher value dismisses on a shorter drag. vaul counts the opposite way; see Migrate from vaul.

Prop Type Default
side 'bottom' | 'top' | 'left' | 'right' | 'center' 'bottom'
desktopSide 'bottom' | 'top' | 'left' | 'right' | 'center' unset: side applies at every width
desktopBreakpoint number 768
modal boolean true
backgroundEffect 'scale' | 'parallax' | 'none' 'scale' for a full-height mobile bottom sheet opened from inside the marked wrapper, else off
backgroundRef React.RefObject<HTMLElement | null> targets backgroundEffect directly, skipping the data-scrollsheet-background query
scrollbar 'overlay' | 'hidden' | 'native' 'overlay'
largestUndimmedDetent DetentSpec dims across the full range
handleOnly boolean false
disableDrag boolean false

side="center" renders a content-sized modal dialog instead of an edge-anchored sheet. detents, disableDrag, and keyboardExpands are all inert: there’s no travel range or drag gesture to configure. See Centered dialog.

desktopSide changes the presentation when the viewport reaches desktopBreakpoint. A matchMedia subscription applies it after mount; the server render and first paint use side. desktopBreakpoint requires desktopSide; used alone, it warns once in development. See Responsive profiles.

Prop Type Default
onTravel (revealedPx: number, progress: number, info: TravelInfo) => void
onRelease (event: PointerEvent, willRemainOpen: boolean) => void
keyboardExpands boolean false
phantomScrollGuard boolean true
animationSpeed number 1
nonce string
themeColorDimming boolean false

keyboardExpands applies to bottom sheets only. See Keyboard.

phantomScrollGuard restores the resting detent after unexpected scrolling. A single scroll event that moves the track more than 120px with no input on the dialog in the last 1.5s (find-in-page, a focus scroll, a browser extension, test tooling’s scrollIntoViewIfNeeded) is returned to the resting detent instead of dismissing the sheet or changing its detent. Turn it off only if your code jump-scrolls the track outside the sheet’s own APIs. Sheets whose resting detent is 120px or shorter are exempt, because a screen reader’s single-jump dismiss looks the same.

animationSpeed multiplies how fast every sheet animation plays: the open/close spring, programmatic detent travel, the content-height morph, and the backdrop, recede, and backgroundEffect transitions. 2 halves every duration and 0.5 doubles it. The spring keeps its shape, so a faster sheet adds no overshoot. Finger-driven travel is unaffected and prefers-reduced-motion still wins. Drawer.Root and Dialog.Root forward it.

Extends <div> (React.ComponentProps<'div'>). className, style, and ref land on the panel.

Prop Type Default
fill boolean false
asChild boolean false
aria-label string accessible name used when no Sheet.Title is rendered

fill stretches [data-scrollsheet-body] to the panel as a flex column, for a fixed header over an inner-scroll list. See Full-height content. asChild renders your single child element as the panel instead of the default <div>, merging the panel’s props into it. The child must be one non-Fragment element; otherwise the default <div> renders and dev builds warn once.

Extends <button>.

Prop Type Default
variant 'inside' | 'floating' | 'outside' 'inside'
asChild boolean false

'inside' flows at the top of the content. 'floating' overlays the panel’s top edge, for full-bleed content such as maps or photos. 'outside' floats the pill in the backdrop above the sheet (bottom sheets only; other sides render 'inside'). All three drag, click, and respond to keys the same way.

Extends <div>.

Prop Type Default
asChild boolean false

Stays on the sheet’s visible bottom edge at every detent and above the on-screen keyboard, and absorbs the bottom safe-area inset so its background runs under the home indicator. Render it as a direct child of Sheet.Content, or inside a wrapper with display: contents. See Pinned footer.

<dialog> below means the host element: a <dialog>, or a <div popover="manual"> when modal={false} and the Popover API exists.

Attribute Where Values
data-scrollsheet-state <dialog> pre | opening | open | closing
data-scrollsheet-side <dialog> bottom | top | left | right | center
data-scrollsheet-modal <dialog> "false" when modal={false}, absent otherwise
data-scrollsheet-scrollbar <dialog> overlay | hidden | native
data-scrollsheet-at-max <dialog> present at tallest detent
data-scrollsheet-behind <dialog> present while a child sheet is open
data-scrollsheet-dragging <dialog> present during a desktop drag
data-scrollsheet-handle-only <dialog> present when handleOnly
data-scrollsheet-disable-drag <dialog> present when disableDrag
data-scrollsheet-detached <dialog> present once --scrollsheet-inset-bottom is set (the inset-card recipe)
data-scrollsheet-sda <dialog> present once CSS scroll-driven animations own the backdrop dim + --scrollsheet-progress, see Browser support
data-scrollsheet-has-handle <dialog> present while a Sheet.Handle is rendered inside the body
data-scrollsheet-has-footer <dialog> present while a Sheet.Footer is rendered inside the body
data-scrollsheet-rtl <dialog> present when the panel’s computed direction is rtl
data-scrollsheet-handle-variant Sheet.Handle floating | outside, absent for inside
data-scrollsheet-fill panel and body present when fill
data-scrollsheet-footer Sheet.Footer always present
data-scrollsheet-background your page wrapper (set by you) marks the element backgroundEffect targets, see Page transitions
data-scrollsheet-nested-scroll an inner scroller (set by you) scroll the list first, then hand off to sheet travel, see Scrollable content
data-scrollsheet-theme an ancestor, usually <html> (set by you) dark | system, anything else renders light, see CSS
data-scrollsheet-no-drag / data-vaul-no-drag anywhere opts an element and its descendants out of desktop drag
data-scrollsheet-backdrop backdrop element present on the built-in backdrop, for restyling it
.scrollsheet-top-chrome status-bar strip rendered with themeColorDimming: a slice of backdrop pinned to the top edge, already at its target dim when the dialog opens. iOS Safari colors the status-bar area by sampling the page once at open and never again, so this strip is what keeps that area in sync with the dim. Restyle or display: none it from your own CSS; it inherits --scrollsheet-backdrop
data-scrollsheet-scrollbar injected thumb marks the library-created .scrollsheet-scrollbar div on a nested scroller
Property Where Values
--scrollsheet-progress backdrop element 0 to 1, same value as onTravel. Set on the backdrop, not the dialog, so read it there (siblings don’t inherit)
--scrollsheet-stack-progress parent panel 0 to 1, set while a child sheet is open. Read it in your own CSS to replace the built-in scale + dim recede with something else
--scrollsheet-max-detent <dialog> tallest resolved detent, px
--scrollsheet-keyboard <dialog> on-screen-keyboard inset, px
--scrollsheet-footer-height <dialog> measured Sheet.Footer height, px, set only while one is rendered
--scrollsheet-backdrop panel (set by you) any CSS color
--scrollsheet-handle / -handle-hover panel (set by you) handle pill color, resting / hover
--scrollsheet-safe-area panel (set by you) usually env(safe-area-inset-bottom)
--scrollsheet-safe-area-top / -left / -right panel (set by you) the same for the other edges, each defaults to its env(safe-area-inset-*)
--scrollsheet-travel panel (set by you) none turns off the enter and exit travel; callbacks still fire. See Morph a trigger into a sheet
--scrollsheet-max-inline / -desktop-margin panel (set by you) width cap (default 640px) and edge margin (default 24px) of the docked desktop column, see Desktop presentation
--scrollsheet-radius panel (set by you) corner radius, default 20px
--scrollsheet-bg panel (set by you) panel background color
--scrollsheet-fg panel (set by you) panel text color
--scrollsheet-close-bg / -close-bg-hover / -close-color / -close-color-hover panel (set by you) the self-closing <Sheet.Close /> button
--scrollsheet-shadow panel (set by you) panel box-shadow
--scrollsheet-inset-x / -top / -bottom / -left / -right / -y panel (set by you) px offsets for the “inset card” recipe (-x/-y are the cross-axis inset for bottom/top and left/right sheets)
--scrollsheet-scrollbar-width / -color panel (set by you) overlay scrollbar thumb, default 4px; also styles nested-scroller thumbs
--scrollsheet-focus-ring / -width handle (set by you) keyboard focus ring on Sheet.Handle
--scrollsheet-center-max-inline panel (set by you) max width guard for side="center", default min(560px, 100%); the panel itself carries no width, set one on your own class
--scrollsheet-center-max-block panel (set by you) max height guard for side="center", default 100%; the panel scrolls internally past this
--scrollsheet-center-gutter panel (set by you) minimum edge padding for side="center" on small viewports, default 20px
Export Extends / type
Sheet The namespace object: Sheet.Root, Trigger, Content, Handle, Footer, Title, Description, Close. The same components are also named exports (Root, Trigger, and so on)
Sheet.Trigger <button>, opens on click. asChild renders your own element instead
Sheet.Title / Sheet.Description <h2> / <p>, auto-wires aria-labelledby / aria-describedby. asChild supported
Sheet.Close <button>, closes on click. asChild supported. Rendered with no children, it draws a styled ✕ button (top-right, 44px hit area, aria-label="Close")
DetentSpec 'full' | 'medium' | 'content' | number | ${number}px. A number is a fraction of the viewport when it is 1 or less, and pixels above 1
Side 'bottom' | 'top' | 'left' | 'right'. The side and desktopSide props also accept 'center'
SheetActions { open(): void; close(): void; snapTo(detent: DetentSpec): void }
TravelInfo onTravel’s third argument: range: readonly [number, number] ([0, tallest detent], px) and progressAtDetents: ReadonlyMap<number, number> (resolved detent height in px to 0-1 progress). Reused and mutated every frame, so read it synchronously
SheetRootProps, SheetContentProps, SheetHandleProps, SheetTriggerProps, SheetFooterProps, SheetTitleProps, SheetDescriptionProps, SheetCloseProps The prop types of the components above
spring(config?) (config?: SpringConfig) => SpringCurve. Compiles a damped spring to a CSS linear() easing; see scrollsheet/motion
SpringConfig, SpringCurve { stiffness?, damping?, mass?, velocity?, restDelta? } and { easing: string; durationMs: number }
isSupported() () => boolean, false on the ~3% of browsers with no <dialog>, where the sheet falls back to a plain modal (see Without <dialog>)
injectStylesInto(root, nonce?) (root: ShadowRoot, nonce?: string) => void, adopts the core stylesheet into a shadow root. Only does anything on the scrollsheet/auto entry. See Shadow DOM
injectToastStylesInto(root, nonce?) Same signature, for the toast stylesheet. A sibling export, not folded into injectStylesInto
Import What it is
scrollsheet Everything above plus Drawer, Dialog, and the toast exports. CSS-external: import scrollsheet/styles.css (and scrollsheet/toast.css for toasts) yourself
scrollsheet/auto The same exports with the stylesheets embedded and injected on first open. Use it for no-bundler-CSS setups, Shadow DOM, and strict CSP with nonce. Never mix it with the default entry in one app
scrollsheet/motion The React-free motion core. Experimental, no semver promise yet
scrollsheet/styles.css, scrollsheet/toast.css The mechanics stylesheet and the toast stylesheet

Each is a thin layer over Sheet.*, exported from the same entry and tree-shaken out unless imported. Only the namespaces are exported, never loose Root or Content members, because vaul’s and Radix’s components collide by name with the ones above.

Export Members and notes
Drawer vaul-compatible: Root, NestedRoot (alias of Root), Trigger, Portal, Overlay, Content, Handle, Footer, Title, Description, Close. Root takes vaul’s props (snapPoints, direction, onClose, fadeFromIndex, and the rest) plus actionsRef, animationSpeed, backdropDismissible, escapeDismissible, flick, keyboardExpands, nonce, onTravel, and scrollbar. Handle adds preventCycle. Overlay renders nothing. See Migrate from vaul
Dialog Radix-compatible, always the centered presentation: Root, Trigger, Portal, Overlay, Content, Title, Description, Close. Root takes open, defaultOpen, onOpenChange, modal, plus actionsRef, animationSpeed, backdropDismissible, escapeDismissible, nonce, and onOpenChangeComplete. Content stamps data-state. See Migrate from Radix Dialog

Prop types: DrawerRootProps, DrawerNestedRootProps, DrawerTriggerProps, DrawerPortalProps, DrawerOverlayProps, DrawerContentProps, DrawerHandleProps, DrawerTitleProps, DrawerDescriptionProps, DrawerCloseProps, DrawerFooterProps, VaulSnapPoint (number | string), and the Dialog* equivalents (DialogRootProps, DialogTriggerProps, DialogPortalProps, DialogOverlayProps, DialogContentProps, DialogTitleProps, DialogDescriptionProps, DialogCloseProps).

Toasts run on their own per-toast DOM, with no Sheet.Root involved. Import scrollsheet/toast.css, or use scrollsheet/auto. Add scrollsheet/styles.css if you also use sheets or dialogs. Guides: Toasts and Migrate from Sonner.

toast(message, data?) returns the toast’s id (number | string). It works before any <Toaster> mounts. data is a ToastData.

Method Signature
toast.success / .error / .info / .warning / .loading / .message (message: ReactNode, data?: ToastData) => id. .message is the untyped default
toast.custom (render: (id) => ReactNode, data?: ToastData) => id. Renders the node verbatim, without the card chrome
toast.promise (promise | () => promise, data: ToastPromiseData<T>) => id & { unwrap(): Promise<T> }. loading, success, error, description, and finally. success and error accept a node or a function returning a node or { message, ...ToastData }
toast.dismiss (id?) => id | undefined. With no id, dismisses every toast on every mounted Toaster
toast.getToasts() / toast.getHistory() Live toasts, and every toast created so far (oldest first, capped at 100)
ToastData field Type Default
id number | string generated. Reusing an id updates that toast in place
description ReactNode
duration number (ms, Infinity disables) the Toaster’s duration
dismissible boolean true
icon ReactNode the per-type icon
action / cancel { label: ReactNode; onClick: (event) => void }
className, classNames, style string, ToastClassnames, CSSProperties
position ToastPosition the Toaster’s position
toasterId string routes the toast to the <Toaster id> with the same id
testId string rendered as data-testid
closeButtonAriaLabel string "Close toast"
onDismiss / onAutoClose (toast: ToastRecord) => void

Mount one anywhere. All props are optional.

Prop Type Default
id string unset: renders the default queue. toasterId is the deprecated alias
position ToastPosition 'bottom-right'
visibleToasts number 3 (minimum 1). Extra toasts are hidden, never evicted
duration number (ms) 4000
closeButton boolean false
expand boolean false. Keeps the stack expanded
gap number (px) 14
offset number | string 24 above 600px; mobile uses a separate gutter
swipeDirections readonly ('top' | 'right' | 'bottom' | 'left')[] per position: a corner allows its own two edges, a center position its own vertical edge
toastOptions Omit<ToastData, 'id' | 'toasterId'> defaults merged under each toast’s own options
icons ToastIcons success, info, warning, error, loading, close overrides
hotkey readonly string[] ['altKey', 'KeyT']. Expands the stack and focuses it. [] disables
containerAriaLabel string "Notifications"
className, style string, CSSProperties
nonce string
sonnerCompat boolean true. false drops every .sonner-* class and data-sonner-* attribute
theme 'light' | 'dark' | 'system' 'light'. Dark and system themes are not implemented and warn once in dev
richColors boolean false. Not implemented; true warns once in dev

At widths of 600px or less, the gutter defaults to 16px independently of offset. Set --scrollsheet-toast-mobile-offset through the Toaster’s style to change it.

classNames.toast applies to every toast. Type classes apply only to the matching type: classNames.default for plain toasts, classNames.success for success toasts, and so on. Toaster-level and per-toast classes both apply.

pointercancel and lost pointer capture reset swipe offsets without dismissing the toast. Auto-dismiss resumes after pointer interaction ends unless hover, an expanded stack, or a hidden tab still pauses it.

ToastType is 'default' | 'success' | 'error' | 'warning' | 'info' | 'loading'. ToastPosition is 'top-left' | 'top-center' | 'top-right' | 'bottom-left' | 'bottom-center' | 'bottom-right' (SonnerPosition is the same type under its older name). useToasts() returns { toasts: ToastRecord[] } for every toast on every toaster; useSonner is the same function.

The React-free layer the sheet runs on. Experimental: the surface may change in minor releases.

Export Signature
spring (config?: SpringConfig) => SpringCurve. Defaults: stiffness 260, damping 30, mass 1, velocity 0, restDelta 0.001. Throws if the config cannot settle within 2 seconds, such as zero damping
sampleSpringAt (config: SpringConfig, atMs: number) => { value: number; velocity: number }. Position (0 to 1) and velocity of the same spring at a time, in closed form
animate (el, prop, from, to, toCss: (value: number) => string, curve: SpringCurve, config: SpringConfig, extraChannels?) => AnimateHandle. One Web Animations spring leg. AnimateHandle has finished, settled, to, durationMs, stop() (freezes the element and returns { value, velocity } for a velocity-carrying next leg), and cancel()
animateScrollTo (el, target, durationMs, axis?: 'x' | 'y', suspendSnap?: boolean | (() => void)) => ScrollAnimation. A rAF scroll tween that any pointer, wheel, or touch input cancels. A suspendSnap function is called when a press stops the tween, with snap left off for you to restore. ScrollAnimation has cancel() and finished: Promise<boolean>
geometryFor (side: Side) => SideGeometry. Axis, scroll property, and sign for a side
mapScroll (value, maxDetent, sign: 1 | -1) => number. Converts between raw scroll position and revealed px; it is its own inverse
recedeTransform (geometry: SideGeometry, progress, scale) => string. The translate3d(...) scale(...) a receded parent panel gets
Side, SideGeometry, SpringConfig, SpringCurve, AnimateHandle, ScrollAnimation Types