Skip to main content

Drawer

A controlled panel that slides in from any edge. Drive it with open + onClose. Supports four directions, preset or custom size, an optional drag handle, a mask-less mode, and a footer slot.

import { Drawer } from '@jbpark/ui-kit';

const [open, setOpen] = useState(false);

<Button onClick={() => setOpen(true)}>Open</Button>
<Drawer open={open} onClose={() => setOpen(false)} title="Settings">
Content
</Drawer>;

Props

PropTypeDefault
openboolean-
onClose() => void-
titleReactNode-
childrenReactNode (body content)-
extraReactNode (top-right slot)-
footerReactNode-
direction'top' | 'bottom' | 'left' | 'right''bottom'
size'small' | 'medium' | 'large' | 'full' | string'medium'
closablebooleantrue
closeIconReactNode-
maskClosablebooleantrue
maskbooleantrue
handlebarbooleantrue
draggablebooleanfalse
roundedbooleanfalse
containerHTMLElement (custom portal target)-
classNames{ mask?; content?; handlebar?; header?; title?; close?; extra?; body?; footer? }-
classNamestring-

size accepts the presets (small 30% / medium 50% / large 75% / full 90%) or any CSS length. Presets map to width for left/right and height for top/bottom.