Skip to content

Drawer

A panel that slides in from the edge of the screen. Used for navigation, detail views, or forms that don't require full-page context switches.

Preview

Right drawer

Project details

View and edit project information, team members, and settings.

StatusActive
Created12 Mar 2026
Members5

Left drawer (navigation)

Bottom drawer

Filters

Select filters to refine your results. Bottom drawers are ideal for mobile filter panels.

Positions

PositionDescription
rightSlides in from the right edge (default)
leftSlides in from the left edge
bottomSlides up from the bottom edge

Props

PropTypeDefaultDescription
openbooleanfalseWhether the drawer is visible
onClose() => void--Close handler
position'left' | 'right' | 'bottom''right'Slide-in direction
titlestring--Drawer title
showClosebooleantrueShow close button
closeOnOverlaybooleantrueClose on backdrop click
childrenReact.ReactNode--Drawer body content
footerReact.ReactNode--Footer actions

Code example

React

tsx
import { useState } from 'react';
import { Drawer, Button } from '@thepace/lexicon/components';

function DetailPanel() {
  const [open, setOpen] = useState(false);

  return (
    <>
      <Button onClick={() => setOpen(true)}>Open details</Button>
      <Drawer
        open={open}
        onClose={() => setOpen(false)}
        position="right"
        title="Project details"
        footer={
          <>
            <Button variant="secondary" size="sm" onClick={() => setOpen(false)}>Cancel</Button>
            <Button variant="primary" size="sm">Save</Button>
          </>
        }
      >
        <p>Project information and settings.</p>
      </Drawer>
    </>
  );
}

Vanilla HTML

html
<div class="lex-modal-overlay" role="presentation">
  <div class="lex-drawer lex-drawer--right" role="dialog" aria-modal="true" aria-labelledby="drawer-title">
    <div class="lex-drawer__header">
      <span id="drawer-title" class="lex-drawer__title">Details</span>
      <button class="lex-drawer__close" aria-label="Close">&times;</button>
    </div>
    <div class="lex-drawer__body">
      <!-- content -->
    </div>
    <div class="lex-drawer__footer">
      <button class="lex-button lex-button--secondary">Cancel</button>
      <button class="lex-button lex-button--primary">Save</button>
    </div>
  </div>
</div>

CSS class reference

ClassPurpose
.lex-drawerDrawer panel
.lex-drawer--rightRight position
.lex-drawer--leftLeft position
.lex-drawer--bottomBottom position
.lex-drawer__headerHeader with title and close
.lex-drawer__titleTitle text
.lex-drawer__closeClose button
.lex-drawer__bodyScrollable body content
.lex-drawer__footerFooter with actions

Accessibility

  • Uses role="dialog" and aria-modal="true".
  • Focus is trapped inside the drawer while open.
  • Escape closes the drawer.
  • Focus returns to the trigger element on close.
  • Body scroll is locked while open.

Guidelines

Do

  • Use right drawers for detail panels and edit forms.
  • Use left drawers for mobile navigation.
  • Use bottom drawers for mobile filter panels.

Don't

  • Don't use a drawer when a modal would be more appropriate (confirmations, alerts).
  • Don't open a drawer from a drawer — use navigation within the same drawer instead.
  • Don't use the drawer for content that needs side-by-side comparison with the main page.

Released under the MIT License. A product by the pace.