Drawer

Drawer is a panel component that slides in from the edge of the screen — ideal for navigation, settings, detail views, and forms as secondary content.

4
Sides
5
Sizes
Built-in
Scroll
Radix
Base

Playground

Preview
MDRight
Drawer
Side
Size
Content
Options
Button Style
Cancel
Save
const [open, setOpen] = useState(false)

<Drawer open={open} onOpenChange={setOpen}>
  <DrawerTrigger asChild>
    <Button variant="outline">Open Drawer</Button>
  </DrawerTrigger>
  <DrawerContent>
    <DrawerHeader>
      <DrawerTitle>Drawer Title</DrawerTitle>
      <DrawerDescription>This is a description of the drawer.</DrawerDescription>
    </DrawerHeader>
    <DrawerBody>
      <p>This is a drawer panel. You can place any content here, including navigation, forms, or detail views.</p>
    </DrawerBody>
    <DrawerFooter>
      <DrawerClose asChild>
        <Button variant="ghost" size="md" pressEffect={false}>Cancel</Button>
      </DrawerClose>
      <Button size="md" pressEffect={false}>Save</Button>
    </DrawerFooter>
  </DrawerContent>
</Drawer>

Sizes

smSide panel or settings
Left/Right: width320px
Top/Bottom: height320px
md (default)Standard (default)
Left/Right: width400px
Top/Bottom: height400px
lgComplex form
Left/Right: width480px
Top/Bottom: height480px
xlDetailed content
Left/Right: width640px
Top/Bottom: height640px
fullFull size
Left/Right: width100%
Top/Bottom: height100%
Padding (all sizes)
Header24px, bottom 0
Body24px
Footer24px, top 0
Closeright 16px, top 16px

Features

Side Placement

Slides in from 4 directions: left, right, top, or bottom. Default is right.

<DrawerContent side="left">...</DrawerContent>
<DrawerContent side="right">...</DrawerContent>
<DrawerContent side="top">...</DrawerContent>
<DrawerContent side="bottom">...</DrawerContent>

Close Button

Use showCloseButton to show or hide the close button. Use closeIcon to replace the default icon.

{/* Hide close button */}
<DrawerContent showCloseButton={false}>...</DrawerContent>

{/* Custom close icon */}
<DrawerContent closeIcon={<ArrowRight />}>...</DrawerContent>

API

Component Structure

Drawer— Radix Dialog
.Trigger.ContentProps.Header.Title.Description.Body.Footer.CloseProps.Overlay.Portal

Props

DrawerContent

side"right"
"left" | "right" | "top" | "bottom"

Slide-in direction

size"md"
"sm" | "md" | "lg" | "xl" | "full"

Panel size (left/right = width, top/bottom = height: 320/400/480/640/full)

showCloseButtontrue
boolean

Show the built-in close button

closeIconBuilt-in SVG icon
ReactNode

Custom close icon

DrawerClose

asChildfalse
boolean

Use child element as the trigger

Anatomy

1
2
3
4
Drawer title
5
6
7
1
Overlay
Background overlay
2
Content
Side panel body
3
Header
Title area
4
Title
Heading text
5
Close
Close button
6
Body
Main content
7
Footer
Action buttons

Best Practices

Do

  • Use Drawer for secondary content and navigation
  • Choose Drawer when you need to preserve the main content context
  • Match the side to the content purpose (nav → left, detail → right)
  • Place action buttons in the Footer to make interactions clear

Don't

  • Don't use Drawer for important confirmation dialogs — use Modal instead
  • Don't nest a Drawer inside another Drawer
  • Don't use Drawer for multi-step wizards — navigate to a dedicated page instead
  • Avoid full size unless necessary — it takes over the entire screen on mobile

Accessibility

Keyboard

EscClose the Drawer
TabCycle focus within the Drawer

ARIA / WCAG

  • role="dialog" Set automatically by Radix
  • aria-labelledby Auto-linked to Title
  • aria-describedby Auto-linked to Description
  • aria-modal="true" Set automatically by Radix
  • Closes on overlay click
  • Body scroll is locked