9.4k

Drawer

A panel that slides in from the edge of the screen with swipe gestures, snap points, and nested drawer support.

API Reference

Installation

Usage

API Reference

Drawer

Root component. Wraps Drawer.Root from Base UI with automatic swipeDirection mapping based on position.

All other props from Drawer.Root are supported, including open, onOpenChange, modal, snapPoints, snapPoint, onSnapPointChange, and snapToSequentialPoints. Note: Snap points only work for bottom drawers.

DrawerTrigger

Trigger button that opens the drawer. Alias for Drawer.Trigger from Base UI.

DrawerPopup

Popup container that displays the drawer content.

Example:

DrawerHeader

Container for the drawer title and description. Supports the render prop for polymorphic composition (e.g. render={<header />}).

DrawerFooter

Footer section for action buttons. Supports the render prop for polymorphic composition.

DrawerTitle

Title component. Alias for Drawer.Title from Base UI.

DrawerDescription

Description component. Alias for Drawer.Description from Base UI.

DrawerPanel

Content container. When scrollable is true (default), wraps content in a ScrollArea component. Supports the render prop for polymorphic composition.

DrawerMenu

Container for drawer menu items. Use with DrawerMenuItem, DrawerMenuSeparator, DrawerMenuGroup, DrawerMenuGroupLabel, DrawerMenuCheckboxItem, DrawerMenuRadioGroup, DrawerMenuRadioItem, and DrawerMenuTrigger to build menus that mirror the Menu component API. Supports the render prop for polymorphic composition.

DrawerMenuItem

Styled menu item that matches MenuItem appearance. Does not close the drawer — wrap with DrawerClose when close-on-click is needed. Supports the render prop for polymorphic composition.

Example: Use with DrawerClose for close-on-click: <DrawerClose render={<DrawerMenuItem />}>Edit</DrawerClose>

DrawerMenuSeparator

Horizontal separator between menu items or groups. Supports the render prop for polymorphic composition.

DrawerMenuGroup

Container for grouping related menu items. Use with DrawerMenuGroupLabel for labeled sections. Supports the render prop for polymorphic composition.

DrawerMenuGroupLabel

Label for a DrawerMenuGroup section. Renders muted, smaller text above a group of items. In nested drawers, use as a section title at the top of the menu (no back button needed — swipe to go back). Supports the render prop for polymorphic composition.

DrawerMenuTrigger

Trigger that opens a nested drawer. Styled like a menu item with a trailing chevron. Use for menu items that open nested drawers (e.g. "Add to Playlist" → nested drawer with playlist options). Wraps DrawerTrigger internally.

Example: <DrawerMenuTrigger>Add to Playlist</DrawerMenuTrigger> opens a nested drawer when tapped.

DrawerMenuCheckboxItem

Checkbox menu item for independent toggles. Supports variant="switch" for toggle-style switches. For selection groups, use DrawerMenuRadioGroup with DrawerMenuRadioItem.

DrawerMenuRadioGroup

Container for radio menu items. Use with DrawerMenuRadioItem for mutually exclusive options (e.g. "Sort by" with Artist, Album, Title).

DrawerMenuRadioItem

Radio menu item. Must be used inside DrawerMenuRadioGroup with a value prop.

DrawerClose

Close button component. Alias for Drawer.Close from Base UI.

DrawerPortal

Portal component for rendering outside the DOM hierarchy. Alias for Drawer.Portal from Base UI.

DrawerBackdrop

Backdrop/overlay component. Alias for Drawer.Backdrop from Base UI.

DrawerViewport

Viewport component for positioning. Alias for Drawer.Viewport from Base UI. Typically not used directly — DrawerPopup renders it internally.

DrawerBar

Drag handle indicator shown when showBar is true on DrawerPopup. Typically not used directly.

DrawerContent

Primitive content wrapper used for polymorphic composition with the render prop. Alias for Drawer.Content from Base UI.

Examples

Inset variant

Straight variant

Scrollable content

Nested drawers

Snap points

Mobile menu

Responsive dialog

Use Drawer on small screens and Dialog on larger ones to show the same content in a modal on desktop and a bottom sheet on mobile.

Responsive menu

Pair Drawer with Menu so actions appear in a dropdown on desktop and a swipe-up sheet on mobile. Use DrawerMenuTrigger for items that open nested drawers on mobile. Nested drawers use DrawerMenuGroupLabel as section titles; swipe to go back.

coss.com ui

Built by and for the team of Cal.com, Inc. — the leading commercial open source company (“coss”).