Drawer

Web
Drawers are modals that slide in from the right on large screens or from the bottom on small screens, providing a temporary, focused view for related actions or content.

Overview

The Drawer component is a modal that provides a temporary, focused view for secondary content or tasks without navigating away from the current screen. It slides in from the right on large screens or from the bottom on small screens, adapting to different device sizes to ensure a seamless user experience. The Drawer is ideal for contextual tasks like editing settings, filtering content, or reviewing additional details related to the primary workflow.

Live demo

Usage

Do

  • Use a Drawer for concise, contextual tasks, such as editing details or filtering results.

  • Include a clear close button and allow users to click outside the Drawer to dismiss it.

  • Open the Drawer in response to user interactions like button clicks or menu selections.

  • Ensure the Drawer adapts to light, dark, and branded themes using design tokens.

Don't

  • Avoid using Drawers for primary navigation or complex workflows, such as multi-step processes.

  • Do not include large images or unrelated content that distracts from the Drawer’s purpose.

  • Avoid auto-opening Drawers unless the context strongly supports it, to prevent user interruptions.

Placement

  • On large screens, Drawers slide in from the right-hand side to avoid obstructing the primary content.

  • On small screens, Drawers slide up from the bottom to optimise vertical space.

Accessibility

  • Implement a focus trap to keep keyboard navigation within the Drawer while it is open.

  • Include a clearly labelled close button (aria-label) and allow users to dismiss the Drawer with the escape key.

  • Use ARIA attributes such as aria-hidden and aria-modal to communicate visibility and state changes to screen readers.

  • Ensure the Drawer dismisses when users click outside of it and supports swipe gestures on mobile devices.

Native alternatives

For iOS and Android, use the platform components instead of the draw. Get support

.