Drawer
A hidden panel that slides in from the side of the screen to reveal navigation or additional actions without disrupting the main view.
Installation
Usage
API
Drawer Props
For Drawer Main
| Attribute | Type | Description | Default |
|---|---|---|---|
| children | ReactNode | ReactNode[] | Root container for the drawer. Must wrap Drawer.Trigger and Drawer.Content components. | - |
| defaultOpen | boolean | Controls whether the drawer is open by default on initial render. | false |
| side | "left" | "right" | "top" | "bottom" | Defines the side from which the drawer appears. | "right" |
For Drawer Trigger
| Attribute | Type | Description | Default |
|---|---|---|---|
| children | ReactNode | Content displayed inside the trigger button that opens the drawer. | - |
| className | string | Additional CSS classes to customize the trigger button styling. | - |
For Drawer Content
| Attribute | Type | Description | Default |
|---|---|---|---|
| children | ReactNode | ReactNode[] | Main container for drawer content. Typically includes Header, Body, and Footer. | - |
| className | string | Additional CSS classes to customize the drawer content container. | - |
For Drawer Header
| Attribute | Type | Description | Default |
|---|---|---|---|
| children | ReactNode | Header section of the drawer, typically used for titles or headings. | - |
| className | string | Additional CSS classes to customize the drawer header styling. | - |
For Drawer Body
| Attribute | Type | Description | Default |
|---|---|---|---|
| children | ReactNode | ReactNode[] | Scrollable main content area of the drawer. | - |
| className | string | Additional CSS classes to customize the drawer body styling. | - |
For Drawer Footer
| Attribute | Type | Description | Default |
|---|---|---|---|
| children | ReactNode | ReactNode[] | Footer section of the drawer, commonly used for actions. | - |
| className | string | Additional CSS classes to customize the drawer footer styling. | - |
For Drawer Close
| Attribute | Type | Description | Default |
|---|---|---|---|
| children | ReactNode | Label displayed inside the close button. Closes the drawer when clicked. | "Close" |
| className | string | Additional CSS classes to customize the close button styling. | - |
Examples
Top Drawer
Bottom Drawer
left Drawer
Right Drawer
Credits
This component is inspired by Rehman Kalawant Design Shared On Github.