Skip to main content

Drawer.Root & Drawer.NestedRoot

Drawer.Root is the top-level container component that manages state, touch events, snap calculations, and context.


Props Reference

PropTypeDefaultDescription
openbooleanundefinedControlled open state of the drawer.
defaultOpenbooleanfalseUncontrolled initial open state. Skips initial enter animation.
onOpenChange(open: boolean) => voidundefinedCallback invoked when open state changes.
snapPoints(number | string)[]undefinedArray of snap point ratios (0.2) or pixel values ('300px').
activeSnapPointnumber | string | nullundefinedControlled active snap point.
setActiveSnapPoint(point: number | string | null) => voidundefinedSetter callback for active snap point.
fadeFromIndexnumbersnapPoints.length - 1Snap point index from which overlay background fades out.
snapToSequentialPointbooleanfalseWhen true, prevents velocity-based skipping of intermediate snap points.
direction'bottom' | 'top' | 'left' | 'right''bottom'Slide orientation direction of the drawer.
shouldScaleBackgroundbooleanfalseScales application content wrapper ([data-temper-drawer-wrapper]).
setBackgroundColorOnScalebooleantrueWhen true, sets document.body background to black while opened.
dismissiblebooleantrueWhen false, dragging/escaping/clicking outside will not close drawer.
modalbooleantrueWhen false, background page elements remain interactive.
handleOnlybooleanfalseRestricts drag gestures exclusively to <Drawer.Handle />.
closeThresholdnumber0.25Drag distance ratio (0 to 1) required to trigger close.
scrollLockTimeoutnumber500Duration (ms) drag is locked after scrolling inside content.
repositionInputsbooleantrueRepositions input fields when virtual mobile keyboard opens.
noBodyStylesbooleanfalseDisables inline style modifications on <body>.
disablePreventScrollbooleanfalseDisables background body scroll lock on mount.
fixedbooleanfalsePrevents upward movement on virtual keyboard open, keeping fixed height.
onDrag(e: PointerEvent, percentage: number) => voidundefinedCallback fired during active drag gesture.
onRelease(e: PointerEvent, open: boolean) => voidundefinedFired when drag pointer is released.
onAnimationEnd(open: boolean) => voidundefinedFired after open or close animation completes.
onClose() => voidundefinedCallback fired when drawer is closed.

Drawer.NestedRoot

Inherits all props from Drawer.Root. Must be placed inside an existing parent <Drawer.Content>. Automatically calculates parent displacement and scale during nested operations.