Atomx Docs
Components

Drawer

A panel that slides in from the bottom edge of the screen, built on vaul — a drag-aware, mobile-friendly alternative to a centred Dialog.

Install

npx shadcn@latest add https://atomx.acau.net/r/drawer.json

Usage

Use a Drawer for content that should slide up from the bottom of the screen and can be swiped away — it reads naturally on touch devices. Prefer Dialog for a centred modal on desktop, and Alert Dialog when the user must explicitly confirm or cancel.

Wrap the trigger in DrawerTrigger and the panel body in DrawerContent. DrawerHeader, DrawerFooter, DrawerTitle, and DrawerDescription structure the content; DrawerClose dismisses the drawer.

<Drawer>
  <DrawerTrigger asChild>
    <Button variant="outline">Open drawer</Button>
  </DrawerTrigger>
  <DrawerContent>
    <div className="mx-auto w-full max-w-sm">
      <DrawerHeader>
        <DrawerTitle>Are you sure?</DrawerTitle>
        <DrawerDescription>This action cannot be undone.</DrawerDescription>
      </DrawerHeader>
      <DrawerFooter>
        <Button>Confirm</Button>
        <DrawerClose asChild>
          <Button variant="outline">Cancel</Button>
        </DrawerClose>
      </DrawerFooter>
    </div>
  </DrawerContent>
</Drawer>

Preview

Props

ComponentNotable props
Draweropen / onOpenChange for controlled use. shouldScaleBackground (default true) scales the page behind the drawer. direction"top" | "bottom" | "left" | "right".
DrawerTriggerAny element. asChild to render the child as the trigger.
DrawerContentThe sliding panel. className for height/style overrides. Includes a drag handle.
DrawerHeader / DrawerFooterLayout wrappers for the top and bottom regions.
DrawerTitle / DrawerDescriptionAccessible heading and supporting text.
DrawerCloseDismisses the drawer. asChild to wrap your own button.