components

Drawer

Slide-in panel for additional content or navigation

Source CodeVaulVaul

Installation

pnpm dlx radianui@latest add drawer

Usage

Imports

/components/ui/drawer.tsx
import {
	Drawer,
	DrawerBody,
	DrawerClose,
	DrawerContent,
	DrawerDescription,
	DrawerFooter,
	DrawerHeader,
	DrawerTitle,
	DrawerTrigger,
} from "@/components/ui/drawer"

Code

/components/ui/drawer.tsx
<Drawer variant="default" direction="left" handle={false} backdrop="overlay">
	<DrawerTrigger>
		<Button variant="outline" color="neutral">
			<ChevronLeft size={20} /> Left
		</Button>
	</DrawerTrigger>
	<DrawerContent>
		<DrawerHeader>
			<DrawerTitle>This is a drawer header</DrawerTitle>
			<DrawerDescription>
				This is a drawer description message.
			</DrawerDescription>
		</DrawerHeader>
		<DrawerBody>
			<p>This is the main content of the drawer.</p>
		</DrawerBody>
		<DrawerFooter>
			<DrawerClose>
				<Button variant="outline" color="neutral">
					Close Drawer
				</Button>
			</DrawerClose>
			<Button>Submit Action</Button>
		</DrawerFooter>
	</DrawerContent>
</Drawer>

Examples

Variant

Position

With Handle

Backdrop

Props

<Drawer>
NameDefaultValues
variant*defaultdefaultfloatrounded
direction*rightleftrighttopbottom
handlefalseboolean
backdrop*overlayoverlayblurnone
<DrawerTrigger>
NameDefaultValues
asChild*trueboolean
<DrawerClose>
NameDefaultValues
asChild*trueboolean
<DrawerFooter>
NameDefaultValues
External Reference--