Skip to content

Drawer

Free

A panel that slides in from an edge of the screen. People drag it with a finger to open or close it, as a bottom sheet or a side panel.

  • Base UI
  • React 19
  • Tailwind CSS 4

Added Nov 8, 2026 · MIT + Commons Clause

Playground

Loading the preview

Props

swipeDirection sets the side. Always render a DrawerTitle, and put long content in DrawerBody.

The sample also uses Button. One command adds them with this item:

filters-drawer.tsx

Drawer

PropTypeDefaultDescription
From Base UIDrawer.RootBase UI docs
openboolean—Whether the drawer is currently open.
defaultOpenbooleanfalseWhether the drawer is initially open. To render a controlled drawer, use the open prop instead.
modal"trap-focus" | booleantrueDetermines 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.

DrawerProvider

PropTypeDefaultDescription
From Base UIDrawer.ProviderBase UI docs
childrenReactNode—

DrawerVirtualKeyboardProvider

PropTypeDefaultDescription
From Base UIDrawer.VirtualKeyboardProviderBase UI docs
childrenReactNode—

DrawerIndentBackground

<div>
PropTypeDefaultDescription
classNamestring—
...props<div> attributes—Every other attribute goes to the <div>, with a ref.

DrawerIndent

<div>
PropTypeDefaultDescription
classNamestring—
...props<div> attributes—Every other attribute goes to the <div>, with a ref.

DrawerTrigger

<button>
PropTypeDefaultDescription
classNamestring—
From Base UIDrawer.TriggerBase UI docs
handleDrawerHandle<Payload>—A handle to associate the trigger with a drawer. Can be created with the Drawer.createHandle method.
payloadPayload—A payload to pass to the drawer when it is opened.
idstring—ID of the trigger. In addition to being forwarded to the rendered element, it is also used to specify the active trigger for drawers in controlled mode (with the Drawer.Root triggerId prop).
...props<button> attributes—Every other attribute goes to the <button>, with a ref.

DrawerSwipeArea

<div>
PropTypeDefaultDescription
classNamestring—
From Base UIDrawer.SwipeAreaBase UI docs
disabledbooleanfalseWhether the swipe area is disabled.
swipeDirection"down""left""right""up"—The swipe direction that opens the drawer. Defaults to the opposite of Drawer.Root swipeDirection.
render—Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a ReactElement or a function that returns the element to render.
...props<div> attributes—Every other attribute goes to the <div>, with a ref.

DrawerSwipeHandle

<div>
PropTypeDefaultDescription
...props<div> attributes—Every other attribute goes to the <div>, with a ref.

DrawerPortal

<div>
PropTypeDefaultDescription
From Base UIDrawer.PortalBase UI docs
keepMountedbooleanfalseWhether to keep the portal mounted in the DOM while the popup is hidden.
container—A parent element to render the portal element into.
className—CSS class applied to the element, or a function that returns a class based on the component's state.
...props<div> attributes—Every other attribute goes to the <div>, with a ref.

DrawerOverlay

<div>
PropTypeDefaultDescription
classNamestring—
From Base UIDrawer.BackdropBase UI docs
forceRenderbooleanfalseWhether the backdrop is forced to render even when nested.
render—Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a ReactElement or a function that returns the element to render.
style—Style applied to the element, or a function that returns a style object based on the component's state.
...props<div> attributes—Every other attribute goes to the <div>, with a ref.

DrawerContent

<div>
PropTypeDefaultDescription
classNamestring—
backdropbooleantrueDim the page under the drawer (Base UI Drawer.Backdrop). Default true.
showSwipeHandlebooleantrueShow the grab bar on bottom and top sheets. Default true.
showCloseButtonbooleanfalseShow the close button (a 24px ghost icon button) in the top end corner. Default false.
closeLabelstring"Close"The accessible name of the close button. Translate it with the page.
portalProps—Other Base UI props of the inner parts. A className here adds to the component classes.
backdropPropsDrawerOverlayProps—
viewportProps—
closeButtonProps—
From Base UIDrawer.PopupBase UI docs
initialFocus—Determines the element to focus when the drawer is opened. - false: Do not move focus. - true: Move focus based on the default behavior (first tabbable element or popup). - RefObject: Move focus to the ref element. - function: Called with the interaction type (mouse, touch, pen, or keyboard). Return an element to focus, true to use the default behavior, or false/undefined to do nothing.
finalFocus—Determines the element to focus when the drawer is closed. - false: Do not move focus. - true: Move focus based on the default behavior (trigger or previously focused element). - RefObject: Move focus to the ref element. - function: Called with the interaction type (mouse, touch, pen, or keyboard). Return an element to focus, true to use the default behavior, or false/undefined to do nothing.
container—A parent element to render the portal element into.
...props<div> attributes—Every other attribute goes to the <div>, with a ref.

DrawerBody

<div>
PropTypeDefaultDescription
classNamestring—
...props<div> attributes—Every other attribute goes to the <div>, with a ref.

DrawerHeader

<div>
PropTypeDefaultDescription
...props<div> attributes—Every other attribute goes to the <div>, with a ref.

DrawerTitle

<div>
PropTypeDefaultDescription
classNamestring—
...props<div> attributes—Every other attribute goes to the <div>, with a ref.

DrawerDescription

<div>
PropTypeDefaultDescription
classNamestring—
...props<div> attributes—Every other attribute goes to the <div>, with a ref.

DrawerFooter

<div>
PropTypeDefaultDescription
...props<div> attributes—Every other attribute goes to the <div>, with a ref.

DrawerClose

<div>
PropTypeDefaultDescription
classNamestring—
...props<div> attributes—Every other attribute goes to the <div>, with a ref.
  • Use it for a bottom sheet, a side panel, an action sheet, or phone navigation.
  • Use swipeDirection (down, up, left, right) to set the side and the swipe that closes it.
  • Use snapPoints for a sheet that stops at set heights.
  • Use DrawerSwipeArea to open it with a swipe from an edge.
  • For a centered task on a desktop page, use a Dialog.
  • For a small panel next to its button, use a Popover.
  • For a list of actions from a button, use a Menu.
EnterorSpaceOn the trigger, opens the drawer.
TabMoves focus between the elements in the drawer. With the default modal, focus stays inside.
EscapeCloses the drawer.

It is a Base UI Drawer, a dialog with gestures. DrawerTitle names it, and focus stays inside while it is modal.

Escape closes it, and focus goes back to the trigger.

DrawerSwipeArea is hidden from assistive tools, so keep a real DrawerTrigger.

Open and close
sheet · 300ms · ease-panel (0.2, 0.4, 0.2, 1) · slides from the edge; no transition while the finger drags
  1. AddedDrawer.
Open the release