Menu

Drawer

Side sheet. 2 sides.

Filters

Installation

$ npx uix-ui@latest add drawer

This copies the file into components/ui/drawer.tsx in your project. npx shadcn@latest add @uix/drawer works too.

Usage

drawer.tsx
import { Drawer } from "@/components/ui/drawer";

<>
  <Button variant="outline" onClick={() => setOpen(true)}>Open filters</Button>
  <Drawer open={open} onClose={() => setOpen(false)} title="Filters" footer={<><Button variant="ghost" onClick={() => setOpen(false)}>Reset</Button><Button onClick={() => setOpen(false)}>Show 14 teas</Button></>}>
    <div style={{ display: "grid", gap: 12 }}>
      <Checkbox label="Green tea" defaultChecked />
      <Checkbox label="Black tea" />
      <Checkbox label="Under ৳500" />
    </div>
  </Drawer>
</>

Props

PropTypeDefaultDescription
sideright | left"right"
openboolean–
onClose() => void–
titleReact.ReactNode–
footerReact.ReactNode–Buttons pinned to the bottom.

Everything else is passed to the root element, so className, aria-* and event handlers work as usual.

Dependencies

Installed for you by the CLI.

  • class-variance-authority
  • clsx
  • tailwind-merge
  • lib/utils.ts
  • components/ui/icons.tsx
esc

↑↓ to navigate · ↵ to select · esc to close