Components · Overlays
Drawer
StableAdded v0.0.1 · updated v5.1.0
Slide-in panel from any edge of the screen.
import { Drawer } from '@nexub/react';Playground
Props
direction
<Drawer.Root open={open} onOpenChange={setOpen}>…</Drawer.Root>Examples
Default
Bottom sheet
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| Drawer.Root | compound | — | Root provider that manages open/close state. |
| Drawer.Trigger | compound | — | Element that opens the drawer. |
| Drawer.Portal | compound | — | Portals the overlay and content into the document body. |
| Drawer.Overlay | compound | — | Dimmed backdrop rendered behind the drawer. |
| Drawer.Content | compound | — | The drawer panel. Accepts a side prop. |
| scrollLock | 'style' | 'class' | 'class' (since 8.0) | On Drawer.Root. How page scroll is locked while open. class adds a class from @nexub/themes/base instead of injecting a <style> tag, so it works under a strict CSP (style-src 'self'). Default style. |
| direction | 'bottom' | 'top' | 'left' | 'right' | 'bottom' | Edge of the screen from which the drawer slides in. |
| Drawer.Header | compound | — | Header section of the drawer panel. Sticky on solid panels (5.1): long content scrolls under it. |
| Drawer.Footer | compound | — | Footer section of the drawer panel. Sticky on solid panels (5.1): actions stay in view while content scrolls. |
| Drawer.Title | compound | — | Accessible title for the drawer. |
| Drawer.Description | compound | — | Supporting description text for the drawer. |
| Drawer.Close | compound | — | Element that closes the drawer. |
| Drawer.Content surface | 'solid' | 'glass' | 'solid' | Glass material on Drawer.Content — see Foundations → Materials. |
| activeSnapPoint | string | number | — | |
| autoFocus | boolean | — | |
| children | React.ReactNode | — | |
| closeThreshold | number | 0.25 | Fraction (0–1) of the drawer that must be dragged away to close it. |
| container | HTMLElement | — | |
| defaultOpen | boolean | — | Opened by default, skips the initial enter animation. Still reacts to open changes. |
| disablePreventScroll | boolean | — | |
| dismissible | boolean | true | When false, dragging, outside clicks and Escape don't close the drawer. |
| fadeFromIndex | number | — | Index of the snap point from which the overlay fades. Defaults to the last one. |
| fixed | boolean | — | Only resize (don't move) the drawer when the on-screen keyboard opens. |
| handleOnly | boolean | false | Only the Drawer.Handle starts a drag. |
| modal | boolean | true | When false, the page behind stays interactive and nothing is locked or trapped. |
| nested | boolean | — | |
| noBodyStyles | boolean | — | When true, vaul sets no styles on body. |
| onAnimationEnd | ((open: boolean) => void) | — | Gets triggered after the open or close animation ends. |
| onClose | (() => void) | — | |
| onDrag | ((event: React.PointerEvent<HTMLDivElement>, percentageDragged: number) => void) | — | |
| onOpenChange | ((open: boolean) => void) | — | |
| onRelease | ((event: React.PointerEvent<HTMLDivElement>, open: boolean) => void) | — | |
| open | boolean | — | |
| preventScrollRestoration | boolean | — | |
| repositionInputs | boolean | — | Reposition inputs instead of scrolling them into view when the keyboard opens. |
| scrollLockTimeout | number | 500 | ms during which the drawer can't be dragged after its content scrolls. |
| setActiveSnapPoint | ((snapPoint: number | string) => void) | — | |
| setBackgroundColorOnScale | boolean | true | |
| shouldScaleBackground | boolean | — | |
| snapPoints | (string | number)[] | — | Snap points, as fractions of the screen (e.g. [0.4, 1]) or px strings. |
| snapToSequentialPoint | boolean | false | Don't skip snap points on fast swipes. |
On iOS & Android: BottomSheet
@nexub/react-nativeAlpha
import { BottomSheet } from '@nexub/react-native';
<BottomSheet open={open} onOpenChange={setOpen} title="Filters" detents={[0.5, 0.9]}>…</BottomSheet>Web vs mobile
Same tokens and prop names. Where the platforms differ:
| Web | iOS & Android | |
|---|---|---|
| Edge | Any side. | From the bottom with detents (content height or a 0–1 screen fraction) and a grabber; keyboard-aware. |
Interactive preview of @nexub/react-native rendered for the web. Native chrome (switches, pickers, Liquid Glass) looks like the platform on a device.
On device

iPhone (iOS simulator)

Pixel (Android emulator)
Screenshots from the latest CI run of the showcase app; the live frame renders the same code for the web.
BottomSheet props
| Prop | Type | Default | Description |
|---|---|---|---|
| openrequired | boolean | — | — |
| onOpenChangerequired | (open: boolean) => void | — | — |
| detents | SheetDetent[] | ['content'] | Heights the sheet rests at: 'content' (fits its content) or a 0–1 fraction of the screen. |
| title | string | — | — |
| childrenrequired | React.ReactNode | — | — |
| dismissible | boolean | true | Drag down, tap the scrim or Android back closes it. |
| scroll | boolean | false | Let the content scroll (long lists). |