Drawer
A temporary side surface for focused work.
npx shadcn@latest add @silicon-ui/drawerInstallation
With the shadcn CLI
npx shadcn@latest add @silicon-ui/drawerManually
Install the dependencies
npm install @radix-ui/react-dialog lucide-react motionCopy these files into your project
- components/silicon-ui/drawer/drawer.tsx
- components/silicon-ui/drawer/drawer.module.css
Shared with other components. Skip any you already have.
- components/silicon-ui/lib/escape.ts
- components/silicon-ui/lib/return-focus.ts
Add the foundation, once per app, for the design and motion tokens
npx shadcn@latest add @silicon-ui/silicon-foundation
Usage
API reference
Drawer
Accepts the props of DialogProps.
DrawerContent
| Prop | Type | Default |
|---|---|---|
title* | string | — |
children* | ReactNode | — |
description | string | — |
side | "left" | "right" | "top" | "bottom" | "right" |
containerRenders the drawer inside this element instead of the page body, anchored to its edges. The element needs position: relative and overflow: hidden. | HTMLElement | null | — |
Also accepts the props of ComponentPropsWithoutRef<typeof DialogPrimitive.Content>.
DrawerTrigger
Accepts the props of ButtonHTMLAttributes.
DrawerClose
Accepts the props of ButtonHTMLAttributes.