Skip to content
Logic2BUI

Search docs

Search components and documentation

New
Menu

Drawer

Extends the Dialog component to display content sliding in from an edge with a drag handle.

Installation

npx logic2b@next add drawer

Usage

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

<Drawer>
  <DrawerTrigger>Open</DrawerTrigger>
  <DrawerContent>
    <DrawerHeader>
      <DrawerTitle>Edit profile</DrawerTitle>
      <DrawerDescription>Make changes to your profile here.</DrawerDescription>
    </DrawerHeader>
    <DrawerFooter>
      <DrawerClose>Cancel</DrawerClose>
    </DrawerFooter>
  </DrawerContent>
</Drawer>

Built on vaul. Unlike sheet, which is a plain Radix Dialog sliding in from an edge, drawer supports drag-to-dismiss and snap points — better suited for mobile bottom sheets.

Examples

Right Direction

Scrollable Content

Accessibility

  • Extends Radix Dialog via vaul, so focus is trapped while open and restored to the trigger on close.
  • Provide a DrawerTitle (and ideally a DrawerDescription) so screen readers announce the drawer — vaul wires them up as the accessible name/description.
  • Dismissable with Escape, an overlay click, or a drag/swipe toward the edge it slides in from.

Live playground

Edit the component props and inspect the exact JSX before copying it. The preview loads only when this section enters the viewport.

Generated JSX
<Drawer
  direction="bottom"
>
  <DrawerTrigger
    className="rounded-md border px-4 py-2 text-sm font-medium"
  >Open release drawer</DrawerTrigger>
  <DrawerContent>
    <DrawerHeader>
      <DrawerTitle>Release checklist</DrawerTitle>
      <DrawerDescription>Review each quality gate before publishing.</DrawerDescription>
    </DrawerHeader>
    <div
      className="px-4 pb-4 text-sm"
    >Tests · accessibility · visual baselines</div>
    <DrawerFooter>
      <DrawerClose
        className="rounded-md border px-4 py-2 text-sm font-medium"
      >Done</DrawerClose>
    </DrawerFooter>
  </DrawerContent>
</Drawer>

API reference

Generated from the public TypeScript exports in src/ui/drawer.tsx.

View JSON

Drawer

Component
Props: React.ComponentProps<typeof DrawerPrimitive.Root>

DrawerPortal

Component
Props: React.ComponentProps<typeof DrawerPrimitive.Portal>

DrawerOverlay

Component
Props: React.ComponentProps<typeof DrawerPrimitive.Overlay>

DrawerTrigger

Component
Props: React.ComponentProps<typeof DrawerPrimitive.Trigger>

DrawerClose

Component
Props: React.ComponentProps<typeof DrawerPrimitive.Close>

DrawerContent

Component
Props: React.ComponentProps<typeof DrawerPrimitive.Content>

DrawerHeader

Component
Props: React.ComponentProps<"div">

DrawerFooter

Component
Props: React.ComponentProps<"div">

DrawerTitle

Component
Props: React.ComponentProps<typeof DrawerPrimitive.Title>

DrawerDescription

Component
Props: React.ComponentProps<typeof DrawerPrimitive.Description>

Accessibility contract

Machine-readable behavior and consumer responsibilities for drawer.

View JSON
Support
Primitive-managed
Pattern
modal dialog
Vaul Dialog
Keyboard interactions for drawer
KeysBehavior
EscapeClose the open surface and restore focus.
Tab Shift+TabCycle focus inside the drawer.

Built-in semantics

  • Uses dialog title/description primitives and modal focus management.

Consumer responsibilities

  • Provide DrawerTitle, an accessible close control and a non-drag dismissal path.