Drawer
A panel that slides in from the edge for a focused task over the page: the CRM's side panel. Built on ui-sdk's Drawer: modal, Escape or a press outside closes it, a swipe toward its edge dismisses it, and focus returns to the trigger.
BetaReady to use. Its API can still change in a minor release; the changelog says when.
import { Drawer, DrawerTrigger, DrawerContent, DrawerHeader, DrawerBody, DrawerFooter } from "@leap-crm/design-system";Playground
Change a prop and the component follows. Its code is under Props.
Props
Best practices
When to use it, and the rules that apply in particular places.
| Guidance | Practice |
|---|---|
| Do | Use it for a focused task over the page, like editing a contact or reviewing an opportunity, where the page stays in place behind it. |
| Do | Give DrawerHeader a title that names the record, like Jane Citizen, and a subtitle for what it is, like Individual · Client. |
| Do | Put long content in DrawerBody, which scrolls under the overlay scrollbar while the header and footer stay put. |
| Do | Set dismissible={false} while the drawer holds unsaved edits, and ask Discard changes? in onDismissAttempt: a swipe, Escape or a press outside then reports the attempt instead of closing. |
| Don't | Turn off closeButton. A panel needs a visible way out besides Escape and a swipe. |
| Don't | Use it for a quick question or a confirmation. Use Dialog, or AlertDialog for a choice that can't be undone. |
Props
Drawer takes ui-sdk's options: open, defaultOpen, onOpenChange, modal, dismissible={false} with onDismissAttempt (ask "Discard changes?"), snapPoints and controller. DrawerClose takes render and value.
Drawer
| Prop | Type | Default | Description |
|---|---|---|---|
| side | ComponentProps<typeof DrawerRoot>["side"] | "end" | The edge it slides from. `end` (right in left-to-right text) for panels. |
DrawerContent
| Prop | Type | Default | Description |
|---|---|---|---|
| children | ReactNode | — | What it shows inside. |
| className | string | — | Classes added to the root element, merged with its own. Tokens only. |
DrawerHeader
| Prop | Type | Default | Description |
|---|---|---|---|
| icon | ReactNode | — | The 20 px icon in the 40 px tile on the left. |
| tone | Exclude<Tone, "default" | "plum"> | "neutral" | "info" | The icon tile's colour, as IconTile. |
| title * | ReactNode | — | Names the drawer. |
| subtitle | ReactNode | — | One muted line under the title, which describes the drawer. |
| closeButton | boolean | true | Shows the round close button. Leave it on: a panel needs a visible way out. |
| className | string | — | Classes added to the root element, merged with its own. Tokens only. |
DrawerBody
| Prop | Type | Default | Description |
|---|---|---|---|
| className | string | — | Classes added to the root element, merged with its own. Tokens only. |
| children | ReactNode | — | What it shows inside. |
DrawerFooter
No props of its own.
Code
What the playground shows, ready to copy.
import {
Button,
Drawer,
DrawerBody,
DrawerClose,
DrawerContent,
DrawerFooter,
DrawerHeader,
DrawerTrigger,
} from "@leap-crm/design-system";
<Drawer>
<DrawerTrigger render={<Button intent="outline">Open drawer</Button>} />
<DrawerContent>
<DrawerHeader title="Jane Citizen" subtitle="Individual · Client" />
<DrawerBody>
<p>jane@citizen.com.au</p>
</DrawerBody>
<DrawerFooter>
<DrawerClose render={<Button intent="outline">Cancel</Button>} />
<DrawerClose render={<Button>Save</Button>} />
</DrawerFooter>
</DrawerContent>
</Drawer>Long content
The body scrolls under the overlay scrollbar; the header and footer stay put.
What the examples share
The imports and the scaffolding the examples above call. The scaffolding lives in this page, not in the library.
import { UserRound } from "lucide-react";
import { Button, Drawer, DrawerBody, DrawerClose, DrawerContent, DrawerFooter, DrawerHeader, DrawerTrigger } from "@leap-crm/design-system";
const fields = [
["Email", "jane@citizen.com.au"],
["Phone", "0412 345 678"],
["Address", "14 Harbour Street, Sydney NSW 2000"],
["Source", "Website enquiry"],
["Responsible", "Ada Hartley"],
] as const;
function EditContact({ long = false }: { long?: boolean }) {
const rows = long ? [...fields, ...fields, ...fields, ...fields] : fields;
return (
<Drawer>
<DrawerTrigger
render={
<Button intent="outline" icon={<UserRound />}>
{long ? "Long panel" : "Edit contact"}
</Button>
}
/>
<DrawerContent>
<DrawerHeader
icon={<UserRound />}
title="Jane Citizen"
subtitle="Individual · Client"
/>
<DrawerBody>
<dl className="flex flex-col gap-4">
{rows.map(([term, detail], index) => (
<div
key={`${term}-${String(index)}`}
className="flex flex-col gap-1"
>
<dt className="text-small text-neutral-text-muted">{term}</dt>
<dd className="text-body m-0">{detail}</dd>
</div>
))}
</dl>
</DrawerBody>
<DrawerFooter>
<DrawerClose render={<Button intent="outline">Cancel</Button>} />
<DrawerClose render={<Button>Save</Button>} />
</DrawerFooter>
</DrawerContent>
</Drawer>
);
}Keyboard
The keys it answers to. Tab moves between components, arrows move within them.
| Keys | What they do |
|---|---|
| Tab | Stays inside the drawer and cycles through its controls in order. |
| Escape | Closes the drawer on top only. |





