Drawer
Drawer reuses Dialog behavior for focus, scroll locking, and dismissal. Pass a
React element as trigger and content as children.
import { Button, Drawer, Input } from '@manti-ui/react'; export default function DrawerBasic() { return ( <Drawer trigger={<Button variant="primary">Edit recipe</Button>} title="Edit recipe" description="Adjust the filling and the finish, then save." footer={({ close }) => ( <> <Button variant="tertiary" onClick={close}> Cancel </Button> <Button variant="primary" onClick={close}> Save </Button> </> )} > <div className="grid gap-4"> <Input label="Name" defaultValue="Kayseri mantı" fullWidth /> <Input label="Filling" defaultValue="Spiced lamb" fullWidth /> <Input label="Finish" defaultValue="Garlic yogurt, mint butter" fullWidth /> </div> </Drawer> ); }
Placement and size
placement is left, right, top, or bottom. size controls width for
left/right and height for top/bottom.
API
| Prop | Type | Default | Description |
|---|---|---|---|
trigger | ReactElement | — | Element cloned with the open trigger props. |
placement | 'left' | 'right' | 'top' | 'bottom' | 'right' | Edge the drawer slides in from. |
size | 'sm' | 'md' | 'lg' | 'md' | Extent along the panel axis (width for left/right, height for top/bottom). |
title | ReactNode | — | Heading shown at the top. |
description | ReactNode | — | Supporting copy under the title. |
children | ReactNode | (({ close }) => ReactNode) | — | Body; accepts a render function receiving { close }. |
footer | ReactNode | (({ close }) => ReactNode) | — | Footer actions; also receives { close }. |
showCloseButton | boolean | true | Show the corner close button. |
open / defaultOpen | boolean | — | Controlled / uncontrolled open state. |
onOpenChange | (open: boolean) => void | — | Called whenever the open state changes. |
modal | boolean | true | Trap pointer interaction and hide content below. |
closeOnInteractOutside / closeOnEscape | boolean | true | Dismiss on outside click / Escape. |
Styling
Anatomy
| Part | Selector | Description |
|---|---|---|
trigger | [data-scope="drawer"][data-part="trigger"] | The cloned opener element. |
backdrop | [data-scope="drawer"][data-part="backdrop"] | The dimmed scrim. |
positioner | [data-scope="drawer"][data-part="positioner"] | Anchors the content to the edge. |
content | [data-scope="drawer"][data-part="content"] | The translucent sliding panel. |
title | [data-scope="drawer"][data-part="title"] | The heading. |
description | [data-scope="drawer"][data-part="description"] | Supporting copy. |
body | [data-scope="drawer"][data-part="body"] | The main content region. |
footer | [data-scope="drawer"][data-part="footer"] | The actions region. |
close-trigger | [data-scope="drawer"][data-part="close-trigger"] | The corner close button. |
Tokens
| Token | Controls |
|---|---|
--manti-drawer-size | size |
Last updated