Drawer
A panel that slides out from the edge of the screen. It can be useful when you need users to complete a task or view some details without leaving the current page.
Drawer#
Contains all the parts of a drawer.
Attribute | Type | Description | Default |
open | boolean | - | null |
defaultOpen | boolean | - | null |
onOpenChange | (open: boolean) => void | - | null |
modal | boolean | - | null |
Drawer.Trigger#
The interactive element that opens the drawer.
Attribute | Type | Description | Default |
asChild | boolean | - | null |
Drawer.Portal#
When used, portals your overlay and content parts into the body.
Attribute | Type | Description | Default |
forceMount | true | Used to force mounting when more control is needed. Useful when controlling animation with React animation libraries. | null |
container | HTMLElement | - | null |
Drawer.Overlay#
A layer that covers the inert portion of the view when the drawer is open.
Attribute | Type | Description | Default |
forceMount | true | Used to force mounting when more control is needed. Useful when controlling animation with React animation libraries. | null |
asChild | boolean | - | null |
Drawer.Content#
Contains Header/Body/Footer to be rendered in the open drawer.
Attribute | Type | Description | Default |
forceMount | true | Used to force mounting when more control is needed. Useful when controlling animation with React animation libraries. | null |
asChild | boolean | - | null |
onEscapeKeyDown | (event: KeyboardEvent) => void | Event handler called when the escape key is down. Can be prevented. | null |
onPointerDownOutside | (event: PointerDownOutsideEvent) => void | Event handler called when the a `pointerdown` event happens outside of the `DismissableLayer`. Can be prevented. | null |
onFocusOutside | (event: FocusOutsideEvent) => void | Event handler called when the focus moves outside of the `DismissableLayer`. Can be prevented. | null |
onInteractOutside | (event: PointerDownOutsideEvent | FocusOutsideEvent) => void | Event handler called when an interaction happens outside the `DismissableLayer`. Specifically, when a `pointerdown` event happens outside or focus moves outside of it. Can be prevented. | null |
onOpenAutoFocus | (event: Event) => void | Event handler called when auto-focusing on open. Can be prevented. | null |
onCloseAutoFocus | (event: Event) => void | Event handler called when auto-focusing on close. Can be prevented. | null |
size | "sm" | "md" | "lg" | - | md |
side | "right" | "left" | "top" | "bottom" | - | right |
Drawer.Header#
To use inside of Popover.Content. Sticky header inside the drawer.
Attribute | Type | Description | Default |
className | string | - | null |
Drawer.Body#
To use inside of Popover.Content. Main content of the drawer. Becomes scrollable when content is overflowing the screen.
Attribute | Type | Description | Default |
className | string | - | null |
Drawer.Footer#
To use inside of Popover.Content. Sticky footer to be rendered in the open drawer. Use it to render CTAs and make them accessible in every condition.
This component does not have any props
Drawer.CloseButton#
The button that closes the drawer.
Attribute | Type | Description | Default |
asChild | boolean | - | null |
size | "sm" | "md" | "lg" | - | md |
intent | "main" | "alert" | "support" | "accent" | "basic" | "success" | "danger" | "info" | "neutral" | "surface" | - | neutral |
design | "filled" | "outlined" | "tinted" | "ghost" | "contrast" | - | ghost |
Drawer.Title#
An accessible title to be announced when the drawer is opened.
Attribute | Type | Description | Default |
asChild | boolean | - | null |
Drawer.Description#
An optional accessible description to be announced when the drawer is opened.
Attribute | Type | Description | Default |
asChild | boolean | - | null |