A side panel for record details, edit forms and filters. Built on native <dialog>, like Modal.
import { Drawer } from "kivu-ui"On this page
import { Drawer } from "kivu-ui";import { useState } from "react";
import { Button, Drawer, Input, Select } from "kivu-ui";
export default function Demo() {
const [open, setOpen] = useState(false);
return (
<>
<Button variant="outline" onClick={() => setOpen(true)}>Edit customer</Button>
<Drawer
open={open}
onClose={() => setOpen(false)}
title="Edit customer"
description="Changes are saved to the CRM."
footer={
<>
<Button variant="ghost" onClick={() => setOpen(false)}>Cancel</Button>
<Button onClick={() => setOpen(false)}>Save</Button>
</>
}
>
<div className="grid gap-4">
<Input label="Company" defaultValue="Nyota Coffee" />
<Input label="Contact email" type="email" defaultValue="amara@nyota.co" />
<Select label="Plan" options={["Starter", "Growth", "Enterprise"]} defaultValue="Growth" />
</div>
</Drawer>
</>
);
}Extends <dialog> attributes.
| Prop | Type | Default | Description |
|---|---|---|---|
open | boolean | - | Required. Whether the drawer is shown. |
onClose | () => void | - | Required. Called on Escape, backdrop click or the × button. |
side | "left" | "right" | "right" | Edge it slides in from. |
size | "sm" | "md" | "lg" | "md" | Controls the size. |
title | ReactNode | - | Heading; becomes the accessible name. |
description | ReactNode | - | Text under the title. |
footer | ReactNode | - | Sticky footer, e.g. Save and Cancel. |
closeOnBackdrop | boolean | true | Close when clicking outside the panel. |
hideCloseButton | boolean | false | Hide the × button. |
bare | boolean | false | Remove the body padding. |
Every component also accepts className and forwards its ref. Root CSS class: .kivu-drawer