Skip to Content

Drawer

Bottom sheet with drag-to-close, spring animations, and full accessibility via Radix UI.

Props

PropTypeDefaultDescription
openbooleanControlled open state
onOpenChange(open: boolean) => voidCalled when open state changes
onClose() => voidCalled when the drawer closes
childrenReactNodeDrawer content
triggerReactNodeOptional trigger element
heightstring | number'50vh'Drawer height (CSS value or number in px)
dragToClosebooleantrueWhether dragging down dismisses the drawer
dragThresholdnumber100Drag distance in px required to trigger close
closeOnOverlayClickbooleantrueWhether clicking overlay closes the drawer
showHandlebooleantrueWhether to show the drag handle indicator
overlayColorstringrgba(0,0,0,0.5)Overlay background color
backgroundColorstring#ffffffDrawer background color
borderRadiusnumber16Top border radius
paddingstring | number0Drawer panel padding
classNamestringPanel className
styleCSSPropertiesPanel style

Ref Handle

MethodDescription
open()Open the drawer
close()Close the drawer

Example

const drawerRef = useRef<DrawerHandle>(null) <Drawer ref={drawerRef} height="60vh" showHandle> <div style={{ padding: 24 }}> <h2>Filters</h2> <p>Drawer content here</p> </div> </Drawer> <button onClick={() => drawerRef.current?.open()}>Show filters</button>
Last updated on