Components/Overlays/Drawer
Interactive docs page: https://wix-pages.com/design-system-documentation/#/component/drawer
The <Drawer/> is a mobile‑first component used to display additional options, actions, or content without navigating away from the current screen. It slides up from the bottom of the viewport and is commonly used to expand dropdown lists on mobile, act as an action sheet when opened from popovers, or present any contextual content in a mobile experience.
Control if a handle is shown in the component header with resizable prop. When enabled, it allows user to expand or collapse the drawer with a swipe gesture.
Control whether the drawer displays a backdrop using the backdrop property. By default, clicking the backdrop will close the drawer.
When the backdrop is disabled, you can allow users to interact with the content behind the drawer by turning off the renderBackdrop property. When this property is off, make sure to provide alternative ways to close the drawer so users don't get trapped in it.
Control if the drawer has a margin around it with a margin prop. The size of it is fixed and varies per different themes.
Add header with action when needed. Drawer content is a react.node, so any content can be placed inside of it.
However, when adding a header, stick to the pattern that the close button is on the left, title is in the center and additional actions are on the right side.
| Name | Type | Default | Description |
|---|---|---|---|
anchor | "end" | "start" | "top" | "bottom" | 'bottom' | Controls the screen edge the drawer is anchored to and slides in from. start and end follow the reading direction, so start is the left edge in LTR and the right edge in RTL. Snap points, dragging and dismissing follow the same axis. |
ariaLabelledBy | string | — | Sets the aria-labelledby attribute on the drawer content. |
backdrop | boolean | true | Specifies whether the backdrop overlay is colored. When false, the overlay is still present and blocks clicks on the content behind it, but it's invisible. |
children (required) | ReactNode | — | Accepts any content to render inside the drawer. |
dataHook | string | — | Applies a data-hook HTML attribute that can be used in the tests. |
dismissible | boolean | true | Specifies whether the drawer can be dismissed by clicking outside of it, pressing Esc or dragging it below its lowest snap point. |
margin | boolean | true | Specifies whether the drawer content box has a margin from the screen edges and rounded bottom corners. |
modal | boolean | true | When false, the drawer behaves as a non-modal dialog: focus isn't trapped, and content outside the drawer remains interactive. Set to true to trap focus and block outside interaction. |
onClose (required) | (open: boolean, reason: DrawerCloseReason) => void | — | Defines a callback function which is called when the user dismisses the drawer. reason is 'outside-press' when the overlay is clicked, 'escape-key' when the Esc key is pressed, 'drag' when the drawer is dragged below its lowest snap point and 'focus-out' when focus leaves a non-modal drawer. It's called only when dismissible is true. |
open (required) | boolean | — | Specifies whether the drawer is open. When false, the drawer content isn't rendered in the DOM. |
renderBackdrop | boolean | true | Specifies whether the backdrop overlay is rendered at all. When false, the overlay element isn't rendered in the DOM. |
repositionInputs | boolean | true | When true, repositions the drawer upward when the on-screen keyboard appears on mobile, keeping inputs visible. When false, falls back to default browser scroll behavior. |
resizable | boolean | true | Displays the drag handle and enables expand and collapse functionality. When enabled, the drawer can also be dragged directly by its content via touch or pen, following the same snap-point and scroll rules as the handle. Mouse drags on the content are left free to select text. |
role | "article" | "button" | "dialog" | "figure" | "form" | "img" | "link" | "main" | "menu" | "menuitem" | "option" | "search" | "table" | "switch" | "status" | "scrollbar" | "checkbox" | "none" | "list" | string & {} | "alert" | "alertdialog" | "application" | "banner" | "cell" | "columnheader" | "combobox" | "complementary" | "contentinfo" | "definition" | "directory" | "document" | "feed" | "grid" | "gridcell" | "group" | "heading" | "listbox" | "listitem" | "log" | "marquee" | "math" | "menubar" | "menuitemcheckbox" | "menuitemradio" | "navigation" | "note" | "presentation" | "progressbar" | "radio" | "radiogroup" | "region" | "row" | "rowgroup" | "rowheader" | "searchbox" | "separator" | "slider" | "spinbutton" | "tab" | "tablist" | "tabpanel" | "term" | "textbox" | "timer" | "toolbar" | "tooltip" | "tree" | "treegrid" | "treeitem" | 'dialog' | Sets the WAI-ARIA role of the drawer content. |
scrollable | boolean | true | Whether the drawer content should be wrapped in a scrollable container, by default it is true. If false, the drawer content is rendered as is, without any scrollable container. |
snapPoints | (string | number)[] | [1] | Sets the heights the drawer snaps to when dragged. A number up to 1 is a fraction of the content height, and a larger number or a string such as '300px' is a height in pixels. The drawer opens at the first snap point. |
zIndex | string & {} | "-moz-initial" | "inherit" | "initial" | "revert" | "revert-layer" | "unset" | "auto" | number & {} | 1000 | Sets the z-index of the drawer and its overlay. |
Import the driver matching your test environment:
| Method | Description |
|---|---|
exists | Checks whether the component found with the given data hook. |
element | Gets the component root element. |
click | Clicks on the component root element. |
base | Returns UniDriver for the base element. |
anchor prop anchors the drawer to the bottom (default), top, start or end edge of the screen. Dragging, snap points and dismissing follow that edge, and start/end swap sides in RTL. (#17273) — has visual changesLast updated: 21 October 2026