Drawer
A panel that slides in from the edge of the screen with swipe gestures, snap points, and nested drawer support.
Overview
Slides up from the bottom edge with a drag bar and a bare footer.
Inset variant
Set variant to inset so the panel floats away from the screen edges on larger viewports.
Straight variant
Set variant to straight to drop the rounded corners and the stacking scale.
Scrollable content
Wrap long content in DrawerPanel. The list scrolls normally while the panel stays draggable from anywhere on its body.
Nested drawers
Nest a Drawer inside another and the one behind shrinks back, recovering as you swipe the front one away.
Snap points
Pass snapPoints to stop the drawer at preset heights. Values below 1 are viewport fractions, anything else is a length. Snap points apply to top and bottom drawers only.
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.
Anatomy
Import all parts and piece them together.
<script setup>
import {
Drawer,
DrawerBar,
DrawerClose,
DrawerDescription,
DrawerFooter,
DrawerHeader,
DrawerMenu,
DrawerMenuCheckboxItem,
DrawerMenuGroup,
DrawerMenuGroupLabel,
DrawerMenuItem,
DrawerMenuRadioGroup,
DrawerMenuRadioItem,
DrawerMenuSeparator,
DrawerMenuTrigger,
DrawerPanel,
DrawerPopup,
DrawerSwipeArea,
DrawerTitle,
DrawerTrigger,
} from "@/components/ui/drawer";
</script>
<template>
<Drawer>
<DrawerTrigger />
<DrawerSwipeArea />
<DrawerPopup>
<DrawerHeader>
<DrawerTitle />
<DrawerDescription />
</DrawerHeader>
<DrawerPanel>
<DrawerMenu>
<DrawerMenuGroup>
<DrawerMenuGroupLabel />
<DrawerMenuItem />
</DrawerMenuGroup>
<DrawerMenuSeparator />
<DrawerMenuCheckboxItem />
<DrawerMenuRadioGroup>
<DrawerMenuRadioItem />
</DrawerMenuRadioGroup>
<DrawerMenuTrigger />
</DrawerMenu>
</DrawerPanel>
<DrawerFooter>
<DrawerClose />
</DrawerFooter>
<DrawerBar />
</DrawerPopup>
</Drawer>
</template>API Reference
Drawer
DrawerTrigger
DrawerPopup
DrawerHeader
DrawerPanel
DrawerFooter
DrawerTitle / DrawerDescription
DrawerClose
DrawerBar
DrawerSwipeArea
DrawerMenu
DrawerMenuItem
DrawerMenuTrigger
DrawerMenuCheckboxItem
DrawerMenuRadioGroup
DrawerMenuRadioItem
DrawerMenuGroup / DrawerMenuGroupLabel / DrawerMenuSeparator
DrawerPortal / DrawerBackdrop / DrawerViewport
Accessibility
Keyboard shortcuts and ARIA behavior.
- Every popup needs a DrawerTitle. Use the sr-only class when the design has no visible heading, as the menu examples do.
- On touch devices the drawer is dragged toward its edge to dismiss, and a scroller inside it keeps scrolling normally.
- A touch drag starts from anywhere on the panel, including buttons, links and form fields. With a mouse, regions marked allowSelection let you select text instead.
- Add data-drawer-swipe-ignore to any subtree that runs its own touch gesture, such as a carousel or a slider.
- Focusing a field raises the software keyboard and the drawer rises above it, then scrolls that field into view. The lift is published as --drawer-keyboard-inset on DrawerViewport, so a pinned footer of your own can offset itself by var(--drawer-keyboard-inset, 0px). Always keep the 0px fallback.