Drawer

A React component for creating drawers.

@vaul

@lucide/react

About


The drawer leverages the Vaul library, developed by emilkowalski.

Installation


1

Install the following dependencies:

npx shadcn@latest add https://sbthemes-storev2.vercel.app/r/drawer.json

Examples


Responsive Dialog

Combine the Dialog and Drawer components to achieve a responsive layout: Dialog for desktop, Drawer for mobile.


API Reference

Root

Root component that controls the open/close state of the drawer.

PropTypeDefault
directiontop,bottom,left,right-
openboolean-
onOpenChange(open: boolean) => void-

Trigger

Element used to toggle the drawer’s visibility.

PropTypeDefault
asChildboolean-

Content

The main panel that slides in from the chosen direction.

PropTypeDefault
childrenReactNode-

Close

The main panel that slides in from the chosen direction.

PropTypeDefault
asChildboolean-