Components
Drawer
A surface panel that slides in from any screen edge, with swipe gestures, snap points, nested stacking, and menu primitives.
import { Button } from "@/components/ui/button";
import {
Drawer,
DrawerClose,
DrawerDescription,
DrawerFooter,
DrawerHeader,
DrawerPanel,
DrawerPopup,
DrawerTitle,
DrawerTrigger,
} from "@/components/ui/drawer";
export default function Particle() {
return (
<Drawer>
<DrawerTrigger render={<Button variant="outline">Open Drawer</Button>} />
<DrawerPopup showBar>
<DrawerHeader>
<DrawerTitle>Edit profile</DrawerTitle>
<DrawerDescription>
Make changes to your profile information here.
</DrawerDescription>
</DrawerHeader>
<DrawerPanel>
<p className="text-muted-foreground text-sm">
Swipe down or use the buttons below to close this drawer.
</p>
</DrawerPanel>
<DrawerFooter>
<DrawerClose render={<Button variant="ghost" />}>Cancel</DrawerClose>
<DrawerClose render={<Button />}>Save changes</DrawerClose>
</DrawerFooter>
</DrawerPopup>
</Drawer>
);
}
Installation
pnpm dlx shadcn@latest add @taut-ui/drawer
Usage
import { Button } from "@/components/ui/button"
import {
Drawer,
DrawerClose,
DrawerDescription,
DrawerFooter,
DrawerHeader,
DrawerPanel,
DrawerPopup,
DrawerTitle,
DrawerTrigger,
} from "@/components/ui/drawer"<Drawer>
<DrawerTrigger render={<Button variant="outline">Open Drawer</Button>} />
<DrawerPopup showBar>
<DrawerHeader>
<DrawerTitle>Title</DrawerTitle>
<DrawerDescription>Description goes here.</DrawerDescription>
</DrawerHeader>
<DrawerPanel>
<p>Main content goes here.</p>
</DrawerPanel>
<DrawerFooter>
<DrawerClose render={<Button variant="ghost" />}>Close</DrawerClose>
</DrawerFooter>
</DrawerPopup>
</Drawer>Examples
Right Position
import { Button } from "@/components/ui/button";
import {
Drawer,
DrawerClose,
DrawerDescription,
DrawerFooter,
DrawerHeader,
DrawerPanel,
DrawerPopup,
DrawerTitle,
DrawerTrigger,
} from "@/components/ui/drawer";
export default function Particle() {
return (
<Drawer position="right">
<DrawerTrigger render={<Button variant="outline">Right Drawer</Button>} />
<DrawerPopup showCloseButton>
<DrawerHeader>
<DrawerTitle>Notifications</DrawerTitle>
<DrawerDescription>
Manage how you receive alerts across devices.
</DrawerDescription>
</DrawerHeader>
<DrawerPanel>
<p className="text-muted-foreground text-sm">
You are all caught up. New notifications will show up here.
</p>
</DrawerPanel>
<DrawerFooter>
<DrawerClose render={<Button variant="ghost" />}>Close</DrawerClose>
</DrawerFooter>
</DrawerPopup>
</Drawer>
);
}
Inset
import { Button } from "@/components/ui/button";
import {
Drawer,
DrawerClose,
DrawerDescription,
DrawerFooter,
DrawerHeader,
DrawerPanel,
DrawerPopup,
DrawerTitle,
DrawerTrigger,
} from "@/components/ui/drawer";
export default function Particle() {
return (
<Drawer position="right">
<DrawerTrigger render={<Button variant="outline">Inset Drawer</Button>} />
<DrawerPopup showCloseButton variant="inset">
<DrawerHeader>
<DrawerTitle>Quick Settings</DrawerTitle>
<DrawerDescription>
Floating surface with rounded corners on all sides.
</DrawerDescription>
</DrawerHeader>
<DrawerPanel>
<p className="text-muted-foreground text-sm">
The inset variant adds outer breathing room on larger screens while
remaining full-bleed on compact viewports.
</p>
</DrawerPanel>
<DrawerFooter variant="bare">
<DrawerClose render={<Button variant="ghost" />}>Dismiss</DrawerClose>
<DrawerClose render={<Button />}>Done</DrawerClose>
</DrawerFooter>
</DrawerPopup>
</Drawer>
);
}
With Menu
"use client";
import { BellIcon, LogOutIcon, SettingsIcon, UserIcon } from "lucide-react";
import { useState } from "react";
import { Button } from "@/components/ui/button";
import {
Drawer,
DrawerHeader,
DrawerMenu,
DrawerMenuCheckboxItem,
DrawerMenuGroup,
DrawerMenuGroupLabel,
DrawerMenuItem,
DrawerMenuSeparator,
DrawerPanel,
DrawerPopup,
DrawerTitle,
DrawerTrigger,
} from "@/components/ui/drawer";
export default function Particle() {
const [notifications, setNotifications] = useState(true);
return (
<Drawer>
<DrawerTrigger render={<Button variant="outline">Open Menu</Button>} />
<DrawerPopup showBar>
<DrawerHeader>
<DrawerTitle>Account</DrawerTitle>
</DrawerHeader>
<DrawerPanel>
<DrawerMenu>
<DrawerMenuGroup>
<DrawerMenuGroupLabel>General</DrawerMenuGroupLabel>
<DrawerMenuItem>
<UserIcon />
Profile
</DrawerMenuItem>
<DrawerMenuItem>
<SettingsIcon />
Preferences
</DrawerMenuItem>
<DrawerMenuCheckboxItem
checked={notifications}
onCheckedChange={setNotifications}
variant="switch"
>
<span className="inline-flex items-center gap-2.5">
<BellIcon className="size-4 shrink-0" />
Notifications
</span>
</DrawerMenuCheckboxItem>
</DrawerMenuGroup>
<DrawerMenuSeparator />
<DrawerMenuItem variant="destructive">
<LogOutIcon />
Sign out
</DrawerMenuItem>
</DrawerMenu>
</DrawerPanel>
</DrawerPopup>
</Drawer>
);
}
Nested
import { KeyRoundIcon, ShieldIcon } from "lucide-react";
import { Button } from "@/components/ui/button";
import {
Drawer,
DrawerClose,
DrawerDescription,
DrawerFooter,
DrawerHeader,
DrawerMenu,
DrawerMenuTrigger,
DrawerPanel,
DrawerPopup,
DrawerTitle,
DrawerTrigger,
} from "@/components/ui/drawer";
export default function Particle() {
return (
<Drawer>
<DrawerTrigger
render={<Button variant="outline">Nested Drawer</Button>}
/>
<DrawerPopup className="mx-auto min-h-80 max-w-[1440px]" showBar>
<DrawerHeader>
<DrawerTitle>Workspace</DrawerTitle>
<DrawerDescription>
Stack up to three nested drawers to preview the depth and scale
transitions.
</DrawerDescription>
</DrawerHeader>
<DrawerPanel>
<DrawerMenu>
<Drawer>
<DrawerMenuTrigger>
<ShieldIcon />
Security settings
</DrawerMenuTrigger>
<DrawerPopup className="mx-auto min-h-72 max-w-[1440px]" showBar>
<DrawerHeader>
<DrawerTitle>Security</DrawerTitle>
<DrawerDescription>
Manage authentication methods and device sessions.
</DrawerDescription>
</DrawerHeader>
<DrawerPanel>
<DrawerMenu>
<Drawer>
<DrawerMenuTrigger>
<KeyRoundIcon />
Recovery keys
</DrawerMenuTrigger>
<DrawerPopup
className="mx-auto min-h-64 max-w-[1440px]"
showBar
>
<DrawerHeader>
<DrawerTitle>Recovery Keys</DrawerTitle>
<DrawerDescription>
Store these one-time codes in a safe place in case
you lose access to your authenticator.
</DrawerDescription>
</DrawerHeader>
<DrawerPanel>
<p className="text-muted-foreground text-sm">
You have 6 unused recovery codes remaining.
Generating a new set will invalidate all previous
codes.
</p>
</DrawerPanel>
<DrawerFooter>
<DrawerClose render={<Button variant="ghost" />}>
Back
</DrawerClose>
<DrawerClose render={<Button />}>
Regenerate
</DrawerClose>
</DrawerFooter>
</DrawerPopup>
</Drawer>
</DrawerMenu>
</DrawerPanel>
<DrawerFooter>
<DrawerClose render={<Button variant="ghost" />}>
Back
</DrawerClose>
</DrawerFooter>
</DrawerPopup>
</Drawer>
</DrawerMenu>
</DrawerPanel>
<DrawerFooter>
<DrawerClose render={<Button variant="ghost" />}>Close</DrawerClose>
</DrawerFooter>
</DrawerPopup>
</Drawer>
);
}
Scrollable
import { Button } from "@/components/ui/button";
import {
Drawer,
DrawerClose,
DrawerDescription,
DrawerFooter,
DrawerHeader,
DrawerPanel,
DrawerPopup,
DrawerTitle,
DrawerTrigger,
} from "@/components/ui/drawer";
import { Separator } from "@/components/ui/separator";
const releases = [
{ notes: "Added Ctrl+Space trigger to Autocomplete.", version: "v1.24.0" },
{
notes: "Redesigned Accordion with M3 expressive segmented surfaces.",
version: "v1.23.0",
},
{ notes: "Introduced optional ripple prop on Card.", version: "v1.22.0" },
{
notes: "Removed color transitions for instant dark/light theme switching.",
version: "v1.21.0",
},
{
notes: "Added BadgeAnchor for dot and counter badges.",
version: "v1.20.0",
},
{
notes: "Improved Ripple diagonal fill across wide buttons.",
version: "v1.19.0",
},
{ notes: "Added nested stacking support to Drawer.", version: "v1.18.0" },
{
notes: "Introduced Command palette with grouped items.",
version: "v1.17.0",
},
{ notes: "Added ScrollArea edge fade masks.", version: "v1.16.0" },
{ notes: "Added spring corner morphing to Button.", version: "v1.15.0" },
{ notes: "Migrated primitives to Base UI v1.", version: "v1.14.0" },
{ notes: "Added dark, light, and taut theme presets.", version: "v1.13.0" },
{ notes: "Added DrawerMenu checkbox and radio items.", version: "v1.12.0" },
{
notes: "Added inset variant with floating rounded corners.",
version: "v1.11.0",
},
{
notes: "Added CardFrame layout for grouped settings panels.",
version: "v1.10.0",
},
{
notes: "Switched Badge semantic variants to solid color-mix surfaces.",
version: "v1.9.0",
},
{
notes: "Fixed Spinner alignment inside loading Button.",
version: "v1.8.0",
},
{
notes: "Removed contain: paint from Ripple to fix subpixel edge clipping.",
version: "v1.7.0",
},
{
notes: "Added instant exit option to Autocomplete popup.",
version: "v1.6.0",
},
{ notes: "Added keyboard shortcut hints to Command.", version: "v1.5.0" },
{ notes: "Added horizontal orientation to Card.", version: "v1.4.0" },
{
notes: "Added swipe-to-dismiss gestures on all four edges.",
version: "v1.3.0",
},
{
notes: "Added reduced-motion fallbacks across components.",
version: "v1.2.0",
},
{ notes: "Initial public release of taut-ui.", version: "v1.0.0" },
];
export default function Particle() {
return (
<Drawer>
<DrawerTrigger
render={<Button variant="outline">Scrollable Drawer</Button>}
/>
<DrawerPopup className="max-h-[60dvh]" showBar>
<DrawerHeader>
<DrawerTitle>Changelog</DrawerTitle>
<DrawerDescription>
Recent updates and improvements across the library.
</DrawerDescription>
</DrawerHeader>
<DrawerPanel className="px-0" scrollFade>
<div className="flex flex-col">
{releases.map((release, index) => (
<div key={release.version}>
<div className="flex flex-col gap-0.5 px-6 py-3">
<span className="font-medium font-mono text-foreground text-xs">
{release.version}
</span>
<p className="text-muted-foreground text-sm">
{release.notes}
</p>
</div>
{index < releases.length - 1 && <Separator />}
</div>
))}
</div>
</DrawerPanel>
<DrawerFooter>
<DrawerClose render={<Button />}>Got it</DrawerClose>
</DrawerFooter>
</DrawerPopup>
</Drawer>
);
}
API Reference
Drawer
Root component wrapping Base UI Drawer.Root and providing edge position context to its children.
| Prop | Type | Default | Description |
|---|---|---|---|
position | "bottom" | "top" | "left" | "right" | "bottom" | Edge from which the drawer slides in |
swipeDirection | "down" | "up" | "left" | "right" | - | Overrides the swipe direction inferred from position |
open | boolean | - | Controlled open state |
defaultOpen | boolean | false | Initial uncontrolled open state |
onOpenChange | (open: boolean) => void | - | Called when the open state changes |
...props | Base UI Drawer Root props | - | All other Drawer Root props are supported |
DrawerPopup
The sliding surface rendered inside DrawerPortal, DrawerBackdrop, and DrawerViewport.
| Prop | Type | Default | Description |
|---|---|---|---|
position | "bottom" | "top" | "left" | "right" | - | Overrides the position inherited from Drawer |
variant | "default" | "straight" | "inset" | "default" | Surface geometry (inset floats with rounded corners on sm+) |
showBar | boolean | false | Renders the drag handle bar along the leading edge |
showCloseButton | boolean | false | Renders a top-end close icon button |
closeProps | Drawer.Close.Props | - | Props forwarded to the built-in close button |
portalProps | Drawer.Portal.Props | - | Props forwarded to the internal portal |
...props | Base UI Drawer Popup props | - | All standard drawer popup props |
DrawerHeader
Header region for DrawerTitle and DrawerDescription.
| Prop | Type | Default | Description |
|---|---|---|---|
allowSelection | boolean | false | Allows text selection inside the header drag zone |
DrawerPanel
Main body container, wrapped in a ScrollArea by default.
| Prop | Type | Default | Description |
|---|---|---|---|
scrollable | boolean | true | Wraps the content in a ScrollArea |
scrollFade | boolean | false | Adds edge fade masks while scrolling |
allowSelection | boolean | true | Allows text selection inside the panel |
DrawerFooter
Action row anchored to the bottom of the drawer.
| Prop | Type | Default | Description |
|---|---|---|---|
variant | "default" | "bare" | "default" | "default" uses a contrasting footer surface; "bare" blends into the popup |
allowSelection | boolean | true | Allows text selection inside the footer |
DrawerTrigger / DrawerClose / DrawerTitle / DrawerDescription / DrawerBar / DrawerSwipeArea
Standard triggers, headings, drag handle bar, and edge swipe-area primitives.
DrawerMenu Primitives
Composable touch-friendly menu items built for mobile and side drawers, all featuring spring corner morphing and ripple feedback:
DrawerMenu,DrawerMenuGroup,DrawerMenuGroupLabel,DrawerMenuSeparatorDrawerMenuItem(variant?: "default" | "destructive")DrawerMenuTrigger(opens a nestedDrawerwith a trailing chevron)DrawerMenuCheckboxItem(variant?: "default" | "switch")DrawerMenuRadioGroup,DrawerMenuRadioItem