UIComponentsReact
A panel that slides in from an edge of the screen and can be swiped away.
Built on the headless Drawer.See its API in Docs
Rendered by React 19.3.1
Installation
npx shadcn@4.23.0 add https://hamur.dev/r/react/drawer.jsonIt also adds utils. The app needs its setup first: Installation.
Usage
Drawer holds DrawerTrigger and DrawerContent; put DrawerHeader, DrawerTitle, DrawerDescription, DrawerFooter and DrawerClose inside the content. swipeDirection (down by default) picks the edge, snapPoints gives it stops, and showSwipeHandle draws the handle. Swiping, snap points and focus come from the headless Drawer.
import {
Drawer,
DrawerPortal,
DrawerOverlay,
DrawerSwipeHandle,
DrawerTrigger,
DrawerClose,
DrawerContent,
DrawerHeader,
DrawerFooter,
DrawerTitle,
DrawerDescription,
} from '@/components/ui/drawer'Examples
Differences from shadcn's: none in the names, since shadcn's Base UI style already uses Base UI's Drawer. Against shadcn's vaul-based drawer, the props are Base UI's: swipeDirection in place of vaul's direction, snapPoints with Base UI's values, and no shouldScaleBackground (Base UI's Drawer.Indent and Drawer.IndentBackground do that job).
API reference
The styled parts pass every prop to the headless part they wrap and add classes. The props, data attributes and keyboard are on Drawer's API reference.