About
A panel built on the native dialog element that slides in from an edge of the screen, for navigation, filters or an edit form, with modal and non-modal modes.
Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Drawer to your project and fits it to your theme.
Code
How Drawer is used: the demo's code. The component's own source comes with a free account.
Usage.tsx
"use client";
import * as React from "react";
import Drawer, { DrawerHandle } from "@/components/ui/drawer";
export default function DrawerDemo() {
const filtersRef = React.useRef<DrawerHandle>(null);
const [picked, setPicked] = React.useState("");
return (
<div className="flex min-h-[420px] w-full flex-col items-start gap-3 p-8">
<button
type="button"
onClick={() => filtersRef.current?.show()}
className="inline-flex items-center rounded-md bg-[#8C6BFF] px-3 py-1.5 text-sm font-medium text-white hover:brightness-110"
>
Filters
</button>
<Drawer
ref={filtersRef}
heading="Filters"
onOpenChange={(isOpen, _reason, value) => {
if (!isOpen) setPicked(value ?? "");
}}
footer={
<>
<button
type="button"
data-sb-close="reset"
className="rounded-md px-3 py-1.5 text-sm font-medium text-[#AEBBDD] hover:text-[#F3F4FA]"
>
Reset
</button>
<button
type="button"
data-sb-close="apply"
className="rounded-md bg-[#8C6BFF] px-3 py-1.5 text-sm font-medium text-white"
>
Apply
</button>
</>
}
>
<p>Planets with rings, in the outer system.</p>
</Drawer>
{picked && <p className="text-sm text-[#AEBBDD]">You chose: {picked}</p>}
</div>
);
}








