Open
Backdrop
Placement
npx npix@latest add Drawer
<>
<Button onClick={()=>r(!e)}>
Try me
</Button>
<Drawer
backdrop
handleClose={()=>r(!1)}
placement="right"
>
<header>
<DrawerTitle>
John Smith
</DrawerTitle>
<DrawerDescription>
jhon.smith@xyz.com
</DrawerDescription>
</header>
<main className="my-4 border-t border-b border-border px-2 py-4 grow block">
<div className="flex space-x-8 items-center hover:bg-accent-hover rounded-md p-2 hover:cursor-pointer">
<EnvelopeIcon className="w-5 h-5" />
<div className="col-span-5">
Inbox
</div>
</div>
<div className="flex space-x-8 items-center hover:bg-accent-hover rounded-md p-2 hover:cursor-pointer">
<HeartIcon className="w-5 h-5" />
<div className="col-span-5">
Favorites
</div>
</div>
<div className="flex space-x-8 items-center hover:bg-accent-hover rounded-md p-2 hover:cursor-pointer">
<ExclamationCircleIcon className="w-5 h-5" />
<div className="col-span-5">
Spam
</div>
</div>
<div className="flex space-x-8 items-center hover:bg-accent-hover rounded-md p-2 hover:cursor-pointer">
<TrashIcon className="w-5 h-5" />
<div className="col-span-5">
Trash
</div>
</div>
<div className="flex space-x-8 items-center hover:bg-accent-hover rounded-md p-2 hover:cursor-pointer">
<Cog6ToothIcon className="w-5 h-5" />
<div className="col-span-5">
Settings
</div>
</div>
</main>
<footer>
<Button type="danger">
Report an issue
</Button>
</footer>
</Drawer>
</>
open
boolean
Whether the drawer is open or not
handleClose
Function
What to do when the user clicks the 'X' button or presses Esc to close the drawer
backdrop
boolean
If true, darken the area outside of the drawer to create a backdrop
placement
"left" | "top" | "right" | "bottom"
Where to place the drawer
Field | Description | Type |
---|---|---|
open | Whether the drawer is open or not | boolean |
handleClose | What to do when the user clicks the 'X' button or presses Esc to close the drawer | Function |
backdrop | If true, darken the area outside of the drawer to create a backdrop | boolean |
placement | Where to place the drawer | "left" | "top" | "right" | "bottom" |