Description
- A drawer is a panel that slides in from the left or right side of the screen.
- It's typically anchored to the left or right edge of the parent container.
- On larger screens, the drawer does not overlay or mask content. Instead, the main view adapts its layout to accommodate the drawer.
- On smaller screens of 768px or less, the drawer switches to full screen mode.
- A drawer can be either:
- a non-dismissible, persistent panel that stays visible alongside the main content, or
- a dismissible panel that the user can hide when not needed. A dismissible drawer is typically opened when the user activates its trigger, such as clicking a button or icon.
- It's purpose is to act as a supporting UI, giving users access to tools, contextual information, or quick actions without disrupting the main workflow.
- Commonly used in dashboards and editing environments where users need to reference or interact with multiple panels simultaneously.
Anatomy
anatomy
Size
Height
- The drawer height should be 100% of the parent container.
- A scrollbar is displayed when the content within the drawer is taller than the available height.
Responsive width
The default drawer width is set to 30 viewport width with a min-width of 288px and a max-width of 760px. These values can be overridden if required by the consuming app.
Default width (30 vw)
Max width (768 px)
Min width (288 px)
Viewport 768px or less
Variations
Position
A drawer can be positioned either to the left or right edge of a parent container.
Left
Right
Header and footer
With header
With hide button (in header)
With footer
Best practices
- Always make sure the main content resizes to accommodate the drawer.
- A drawer should load content dynamically without refreshing the page.