Drawer
A sliding panel that appears from the edge of the screen.
Examples
Basic Usage
Click the buttons to open drawers from different sides.
Drawer Example
import { useState } from 'react'
import { Button, Drawer } from '@creo-team/buzz-ui/client'
export default function Example() {
const [open, setOpen] = useState(false)
return (
<>
<Button onClick={() => setOpen(true)}>
Open Drawer
</Button>
<Drawer
open={open}
onOpenChange={setOpen}
side="right"
size="md"
title="Drawer Title"
description="This is a drawer description"
>
<div className="space-y-4">
<p>Drawer content goes here.</p>
<Button onClick={() => setOpen(false)}>
Close Drawer
</Button>
</div>
</Drawer>
</>
)
}
Sizes
Drawers support different sizes: sm, md, lg, xl, and full.
API Reference
Prop | Type | Default | Description |
---|---|---|---|
open * | boolean | — | Whether the drawer is open |
onOpenChange * | (open: boolean) => void | — | Callback when open state changes |
side | 'left' | 'right' | 'top' | 'bottom' | 'right' | Which side the drawer slides from |
size | 'sm' | 'md' | 'lg' | 'xl' | 'full' | 'md' | Size of the drawer |
title | string | — | Optional title for the drawer |
showCloseButton | boolean | true | Whether to show the close button |
Full API: /components/drawer/api