Skip to content

React Drawer and Bottom Sheet

A glass React drawer that slides in from any edge, with bottom sheets you can drag, snap and swipe away. Use it as a bottom sheet for filters on a mobile product list, with snap points such as peek, half and full so people can glance at the filters or expand them to full height.

npx shadcn@latest add https://lokendra-builds.github.io/sheenui/r/drawer.json

Headphones

148 results

  • Drawer
  • DrawerBody
  • DrawerClose
  • DrawerTitle
  • DrawerFooter
  • +13 more
  • +10 more

Bottom sheet

Swipe the sheet down (or press Escape, or tap outside) to dismiss it. Releasing a quick flick keeps its momentum; a button close is shorter and never overshoots.

Files to copy

5 folders · 9 files · 4 packages
From theme/src/
  • components/drawer/drawer.tsx
  • components/drawer/parts/{content.tsx, model.ts, parts.tsx}
  • hooks/{use-direction.ts, use-latest.ts}
  • lib/{cn.ts, form.ts, modal-tab-trap.ts}
  • styles/
shadcn CLI
npx shadcn@latest add https://lokendra-builds.github.io/sheenui/r/drawer.jsonRegistry item: drawer. The styles need the Tailwind v4 glass UI setup.
The examples also use
  • components/button/
  • components/input/
  • components/spinner/
  • components/switch/
  • hooks/{use-magnetic.ts, use-media-query.ts, use-preferences.ts}
  • motion/{gate.ts, tokens.ts}
  • lib/{field-control-shell.tsx, field-size.ts, motion-props.ts, state-light.tsx}
npx shadcn@latest add https://lokendra-builds.github.io/sheenui/r/button.json https://lokendra-builds.github.io/sheenui/r/input.json https://lokendra-builds.github.io/sheenui/r/switch.json
Packages
pnpm add @base-ui/react clsx motion tailwind-merge

Snap points

Peek, half and full heights. Peek is measured from the content (handle, header and the first row) and half always shows more than peek, even on a landscape phone. Drag between them, flick to skip one, or use the handle: it is a button that reads out the current height (Enter cycles, arrow keys step). Keyboard focus is never hidden: rows scroll into view inside the sheet, and a control that can't (below the screen edge) opens it fully. A click or tap never changes the height.

Side and top sheets

side picks the edge (and the swipe direction that closes it). inset floats the panel off the edges with rounded corners.

Nested sheets

A drawer opened from inside another one stacks on top; the one behind steps back and dims. Swipe or Escape closes only the front one.

Drawer

PropTypeDefaultDescription
modalboolean | "trap-focus"trueDetermines if the drawer enters a modal state when open. - true: user interaction is limited to just the drawer: focus is trapped, document page scroll is locked, and pointer interactions on outside elements are disabled. - false: user interaction with the rest of the document is allowed. - 'trap-focus': focus is trapped inside the drawer, but document page scroll is not locked and pointer interactions outside of it remain enabled.
sideDrawerSideProp"bottom"The edge the drawer slides in from. It is also the direction a swipe dismisses it. "left" and "right" are physical and never flip; "start" and "end" follow the text direction (<html dir> or Base UI's DirectionProvider): "start" is the left edge in ltr and the right edge in rtl.
snapPointsreadonly DrawerSnapPoint[]NoneSnap heights for a bottom sheet, smallest first. Ignored on other sides.
snapPointDrawerSnapPoint | nullNoneControlled snap point (use with onSnapPointChange).
defaultSnapPointDrawerSnapPoint | nullthe first oneSnap point the sheet opens at.
onSnapPointChange((snapPoint: DrawerSnapPoint | null, eventDetails?: BaseDrawer.Root.SnapPointChangeEventDetails) => void)NoneCalled when the snap point changes: by a drag (with Base UI's event details), or by the handle button / keyboard / focus (no event details).
labelsDrawerLabelsInputdefaultDrawerLabelsEvery other string, for translation: labels={{ close: "…" }}; omitted keys keep the English of defaultDrawerLabels. All 6 keys of DrawerLabelsInput are listed in the key table under the props table.
open / defaultOpen / onOpenChangeboolean / boolean / (open, details) => voidfalseControlled or uncontrolled open state (Base UI).
disablePointerDismissalbooleanfalseKeep it open on outside presses.
DrawerLabelsInput keys and English defaults (6)
Pass any key in labels; the rest keep the defaults of defaultDrawerLabels.
KeyEnglish default
closeClose
expandExpand sheet
collapseCollapse sheet
snapPoints{ peek: "Peek height", half: "Half height", full: "Full height" }
customSnapPoint(position, count) => `Height ${position} of ${count}`
handleHintArrow keys change the height.

DrawerContent

PropTypeDefaultDescription
childrenReactNodeNoneThe sheet's content: usually DrawerHeader, DrawerBody and DrawerFooter.
showClosebooleantrueShow the × button in the top corner.
handlebooleanon for bottom and top sheetsShow the drag handle.
insetbooleanfalseFloat the panel off the edges (rounded on every side) instead of attaching it to the edge.
keyboardAwarebooleantrueKeep focused fields above the on-screen keyboard (bottom sheets with forms). Uses Base UI's Drawer.VirtualKeyboardProvider.
containerHTMLElement | ShadowRoot | RefObject<HTMLElement | ShadowRoot | null> | null<body>Where to portal the drawer (defaults to <body>).
viewportClassNamestringNoneAdds extra classes to the full-screen positioning layer.
backdropClassNamestringNoneClass for the dimmed scrim behind a modal drawer.
initialFocus / finalFocusref | function | booleanpanel / triggerWhere focus goes when it opens and closes (Base UI).

Parts

PropTypeDefaultDescription
DrawerTrigger / DrawerCloseBase UI Trigger / CloseNoneUse render={<Button />} to style them as buttons.
DrawerHeaderdivNoneTitle and description; stays put while the body scrolls.
DrawerBodyBase UI Drawer.ContentNoneThe scrolling part. A tab stop only while it overflows; mouse text selection never drags the sheet.
DrawerFooterdivNoneActions: stacked on phones, a right-aligned row from sm.
DrawerSwipeAreaBase UI SwipeAreaNoneInvisible edge strip that opens the drawer with a swipe (touch screens).
createDrawerHandle()() => HandleNoneOpen a drawer from triggers elsewhere: <Drawer handle={h}> + <DrawerTrigger handle={h}>.

Keyboard

KeysAction
Enter/SpaceOpen it from the trigger.
Tab/Shift + TabCycle inside; focus is trapped while it is modal.
EscapeClose it and return focus to the trigger.
Enter/Arrow Up/Arrow DownOn the handle, with snap points: cycle or step through the heights.

Accessibility

  • A modal dialog (Base UI): named by DrawerTitle, described by DrawerDescription; the page behind is inert.
  • The handle is a real button with snap points and tells screen readers the current height. A swipe is a shortcut: a button always closes it.
  • Under reduced motion the sheet fades instead of sliding.

All exports on this page

  • Drawer — Drawer / sheet: a strong-glass panel that slides in from an edge of the screen.
  • DrawerBody — The scrolling part of the sheet.
  • DrawerClose — A button inside the drawer that closes it (a "Done" or "Cancel" action in DrawerFooter).
  • DrawerContent — The glass panel of a Drawer, portalled to the end of the body with a dimmed scrim (for a modal drawer).
  • DrawerDescription — Muted helper text under the title.
  • DrawerFooter — Bottom row of actions, separated by a hairline: a column on phones (primary action first on screen) and a right-aligned row from sm up.
  • DrawerHandle — The grab bar.
  • DrawerHeader — Top section of the sheet: stacks the title and description, with room on the right for the × button.
  • DrawerSwipeArea — An invisible strip along a screen edge that opens the drawer with a swipe (touch screens).
  • DrawerTitle — The drawer's heading.
  • DrawerTrigger — The element that opens a Drawer (a <button> by default; use render={<Button />} for a SheenUI button).
  • createDrawerHandle — Connects a Drawer to triggers rendered elsewhere: <Drawer handle={h}> + <DrawerTrigger handle={h}>.
  • createSideDrawerHandle — Connects a SideDrawer to triggers rendered elsewhere: <SideDrawer handle={h}> + <SideDrawerTrigger handle={h}>.
  • defaultDrawerLabels — Default English strings of DrawerLabels; spread it and override single keys to reword.
  • drawerSnapPresets — Starting values of the presets.

When to use the Drawer / Sheet

  • Use it for a mobile bottom sheet that people drag between a peek, half and full height, such as filters on a product list or a place card on a map, or as a side panel on desktop.
  • Use it for a navigation menu or cart panel sliding in from the left or right with side="left" or "right", or floating off the edge with the inset prop on DrawerContent.
  • Use it for a quick form on a phone, where keyboardAware (on by default) keeps focused fields above the on-screen keyboard while the sheet remains swipeable.
  • Skip it when you need a centered modal, which Dialog handles, or a record detail and edit panel with close guards and resizing, where SideDrawer is built for that.
  • Pair it with Button through the render prop on DrawerTrigger, Tabs or RadioGroup inside DrawerBody for filter controls, and Toast to report that the applied choices were saved.

Frequently asked questions

67 components pages in all: browse them on All components.

By Lokendra Singh Rathore (GitHub, opens in a new tab). Published , updated .