cnippet/ui
  1. ui
  2. overlays
  3. drawer

overlays

Drawer

A panel that slides in from the edge of the screen with swipe gestures, snap points, and nested drawer support. Built with Base UI and Tailwind CSS. Copy-paste ready.

API Reference

Installation

Usage

Position

Use the position prop on Drawer to control which edge the drawer slides in from. Defaults to "bottom".

Variants

The DrawerPopup component supports a variant prop to control its shape:

  • default (default): Rounded corners facing inward
  • inset: Adds screen-edge inset spacing on larger viewports
  • straight: No rounded corners — flush to the screen edge

Footer Variant

The DrawerFooter component supports a variant prop:

  • default: Includes a border-top, background color, and padding
  • bare: Removes the border and background for a minimal appearance

Drag bar

Pass showBar to DrawerPopup to render a visible drag handle bar.

Anatomy

Good to know

  • Set position on Drawer, not on the popup: "bottom" (default), "top", "left" or "right". The swipe-to-dismiss direction follows it.
  • Users can drag or swipe the drawer to close it. For a panel that only closes with buttons, use Sheet.
  • Unlike Dialog and Sheet, there's no close (X) button by default. Add one with showCloseButton, or show a drag handle with showBar.
  • snapPoints on Drawer lets a bottom drawer rest at partial heights, such as half the screen.
  • DrawerPopup variant is "default" (rounded inner corners), "inset" (space around it on larger screens) or "straight" (flush with the edge).
  • The DrawerMenu* parts build a mobile menu inside a drawer. They're separate from the Menu component.
  • The state props are open, defaultOpen and onOpenChange.

API Reference

Drawer

Root provider. Wraps Base UI Drawer.Root.

DrawerTrigger

Button that opens the drawer.

DrawerClose

Button that closes the drawer.

DrawerPopup

The sliding panel.

DrawerHeader

Container for DrawerTitle and DrawerDescription.

DrawerFooter

Action row at the bottom of the drawer.

DrawerTitle

Accessible title element.

DrawerDescription

Accessible description.

DrawerPanel

Scrollable content region. Automatically wrapped in ScrollArea.

DrawerMenu / DrawerMenuItem / DrawerMenuSeparator / DrawerMenuGroup / DrawerMenuGroupLabel / DrawerMenuTrigger

Navigation menu sub-components for drawer nav patterns.

DrawerMenuCheckboxItem

Toggleable checkbox item inside a drawer menu.

DrawerMenuRadioGroup / DrawerMenuRadioItem

Single-selection radio group inside a drawer menu.

Examples

Multiple Positions — Inset

Opens a drawer from each of the four edges (top, right, bottom, left) using the inset variant with screen-edge spacing.

Multiple Positions — Straight

Same four-edge positioning demo using the straight variant for flush, full-bleed drawers with no rounded corners.

Multi-step Nested Drawers

Chains multiple drawers as a step-by-step wizard flow, each opening on top of the previous one.

A side drawer containing a full navigation menu, the standard pattern for mobile app side navigation.

Filter & Sort Panel

A bottom or side drawer with filter checkboxes and sort controls for refining list or grid views.

Shopping Cart

A right-side drawer showing cart items, quantities, subtotal, and a checkout button.

Notification Center

A drawer listing recent notifications with timestamps and mark-as-read actions.

Confirm Destructive Action

A bottom drawer used as a confirmation step before a destructive operation — shows a clear warning description and a destructive action button.

Edit Profile Form

A bottom inset drawer containing a profile edit form with first name, last name, email, and bio fields. Saving shows a transient "Saved!" confirmation.

User Preferences & Theme Settings

A right-side straight drawer with theme switcher tiles (Light / Dark / System), a language select, and a push-notification toggle switch.

File Attachments with Upload

A bottom drawer with a drag-and-drop upload zone and an existing attachments list — individual files can be removed before confirming the selection.

Activity Log with Status Timeline

A right-side straight drawer rendering a vertical timeline of deployment and build events, each tagged with Completed, In progress, or Pending status badges.

A bottom drawer with a live-filtered FAQ accordion — typing in the search field narrows the list and individual questions expand inline.

Quick Actions Grid

A bottom drawer triggered by a contextual ellipsis button that presents an icon grid of actions (Edit, Share, Bookmark, Archive, Delete, etc.), each closing the drawer and reporting the chosen action.