Drawer
freeDrawer brings supporting panels into the current page without a route change.
Installation
Add this component with the NateUI CLI.
Examples
Basic
Placement
Width & Height
Footer
Custom Style
Closable
Custom Backdrop
Form
API
Drawer accepts the props below plus native props for the drawer content div.
| Prop | Description | Type | Default |
|---|---|---|---|
bodyClass | Extra class names applied to the scrollable body region. | string | - |
children | Content rendered in the scrollable body of the drawer. | ReactNode | - |
closable | Shows the default close button in the header. | boolean | true |
contentClassName | Class names applied to the drawer content surface. | string | - |
footer | Content rendered in a footer region below the body. | string | ReactNode | - |
footerClass | Extra class names applied to the footer region. | string | - |
headerClass | Extra class names applied to the header region. | string | - |
height | Height of the drawer. Used when placement is 'top' or 'bottom'. | string | number | 370 |
isOpen | Controls whether the drawer is visible. | boolean | false |
lockScroll | Locks document scrolling through the overlay while the drawer is mounted. | boolean | true |
onClose | Called when the drawer asks to close through the close button, overlay, Escape key, or a drag-to-dismiss gesture. | DrawerOpenChangeHandler | - |
onOpen | Called when the floating layer reports that the drawer opened. | DrawerOpenChangeHandler | - |
overlayClassName | Class names applied to the overlay element. | string | - |
placement | Edge the drawer slides out from. 'top' and 'bottom' add a drag handle for dismissing the drawer by swipe. | DrawerPlacement | 'right' |
ref | Ref forwarded to the drawer content element. | Ref<HTMLDivElement> | - |
shouldCloseOnEsc | Allows Escape to request closing the drawer. | boolean | true |
shouldCloseOnOverlayClick | Allows an overlay click to request closing the drawer. | boolean | true |
title | Title rendered in the header region. | string | ReactNode | - |
width | Width of the drawer. Used when placement is 'left' or 'right'. | number | 370 |
...nativeDivProps | Native props applied to the drawer content element. | NativeDrawerDivProps | - |