Drawer
Search the component library

Drawer

v2.0.0-beta.2

The drawer component offers a convenient method for presenting secondary information which doesn't need to be immediately visible.

Usage Guidelines

Drawers should contain secondary content which only needs to be presented when specifically requested by the user, such as help information.

Features

  • Overview and item detail levels
  • Animations for show/hide and viewing item details
  • Accessible implementation

Showing/Hiding

Selecting some UI element on the main page can trigger the drawer to slide in from the right, for example clicking ‘Help’ in the header.

A drawer can be dismissed by clicking the included ‘x’ icon, by selecting the trigger element again, or by hitting the escape key.

Basic View

The basic version of the drawer has a section for a title at the top and a built in close ‘x’ icon.

Content may populate the area below this with 30px margins. Custom background colors and dividing lines may extend to 100% width.

Detail View

If the drawer is presenting a list of items, selecting one of them should transition the drawer to the detail view. This adds a back label and icon for returning to the originating view.

The drawer should retain state on close, i.e. closing the drawer on a detail view and then reopening the same drawer will return the user to that detail view. However, refreshing the page will reset the state.

Animation

Displaying the second level uses an animation to provide context.

Responsive Behavior

The drawer maintains the same behavior all the way down to the extra small breakpoint, at which point it begins taking up 100% of the viewport width.

Redlines

Basic View

Spacing
  • 30px side, 25px top and 30px bottom margins around the content area
  • 25px vertical margins below the title area, 30px side margins
  • Drawer is 320px wide at the Small breakpoint and wider
  • Drawer is 100% width at the Extra Small breakpoint
  • Dividing lines may extend past the content area, up to 100% width
Background
  • Default background is white, may customized to an accessible color and extend to 100% width.
  • Border is 1px solid alto (#D9D9D9)
Typography
Icons
  • Close icon is remove-sm-24
  • A focused icon will use the standard browser outline for focus
Shadow
  • box-shadow: 0 3px 5px 0 rgba(199,199,199,0.70);
Title Separator
Keyboard Shortcuts
  • Pressing escape should close the drawer in any mode
Focus Behavior
  • Opening the drawer moves focus from the triggering element to the first focusable item within the drawer (typically the Close icon).
  • Tabbing within the drawer should cycle through focusable items like normal
  • The drawer should capture focus, so you won’t be able to tab out of the drawer
  • Upon dismissing the drawer focus should be restored to the triggering element

Detail View

Title
  • Use a static “Back” label
  • Focusing the “< Back” element will use the standard browser outline for focus
Icon
  • Pearson Icon (chevron-back-18)
  • 10px spacing between icon and label
Focus Behavior
  • Follow the patterns of the Basic Drawer
  • Transitioning into the detail view should move focus to the first focusable element of the view (typically the back button)
  • Focus should again be captured
  • Focus targets from the Basic View should not be accessible

Show/Hide Transition

Animation
  • Slide in from the right
Timing
  • 0.5 seconds
  • ease-in-out easing

Detail View Transition

Animation
  • Content container slides in from the right
  • Title slides away to the left
  • Back fades/slides in from about the middle of the drawer
Content
  • 0.3 seconds
  • ease-in-out
  • Opacity is 0 in hidden state
Hiding Title
  • Move 40px off to the left
  • Opacity fades to 0
  • 0.3 seconds
  • ease-in-out
Restoring Title
  • Restore properties
  • 0.4 seconds
  • ease-in-out
Showing Back
  • Starts with midpoint centered at 60% of the content width and opacity of 0
  • 0.3 seconds
  • ease-in-out
Hiding Back
  • Reset position and opacity
  • 0.4 seconds
  • ease-in-out
Available Styles Reference As (How do I use this?)
Basic View [](/design/c/drawer/v2.0.0-beta.2/#rd-basic-view)
Detail View [](/design/c/drawer/v2.0.0-beta.2/#rd-detail-view)

Changelog

2.0.0-beta.2

Apply new brand to existing component.

2.0.0-beta.1

Redesign align with new brands

1.0.0-beta.8

  • ADDED: Ability to include 100% width divider lines and custom background colors

1.0.0-beta.7

  • ADDED: Dimensions to redlines
  • ADDED: Dependency links for breakpoints

1.0.0-beta.6

  • CHANGED: Dependencies to final versions.
  • ADDED: Missing colors dependency.
  • ADDED: Additional detail on focus behavior for keyboard users.

1.0.0-beta.5

  • ADDED: Dependency links

1.0.0-beta.4

  • ADDED: Exported styles

1.0.0-beta.3

  • ADDED: Animation redlines
  • ADDED: Accessibility checklist
  • ADDED: Sketch and AI mockups

1.0.0-beta.2

  • ADDED: Basic -> Detail transition video
  • ADDED: Initial redlines

1.0.0-beta.1

Initial version.