Skip to content

Drawer

Drawer

Overlay component for displaying a sliding panel from the edge of the screen.

Import

import { Drawer } from '@primitivekit/astro';

Basic Usage

<Drawer>Content</Drawer>

Props

No props available.

Customization

The Drawer component supports CSS variables for complete customization:

<Drawer style={{
  '--drawer-bg-color': '#007bff',
  '--drawer-text-color': '#ffffff'
}}>Custom</Drawer>

Design Tokens

The following design tokens are available for customization:

  • --drawer-mask-background
  • --drawer-mask-z-index
  • --drawer-mask-opacity
  • --drawer-mask-backdrop-filter
  • --drawer-transition-duration
  • --drawer-transition-timing
  • --open
  • --drawer-z-index
  • --drawer-background
  • --drawer-box-shadow
  • … and 58 more

Accessibility

The Drawer component is fully accessible and follows WCAG 2.1 AA standards:

  • ✅ Semantic HTML elements
  • ✅ Keyboard accessible
  • ✅ Focus visible indicator
  • ✅ Proper ARIA attributes
  • ✅ Screen reader compatible
  • ✅ Touch target size (44x44px minimum)
  • ✅ Color contrast compliance

Keyboard Navigation

KeyAction
TabMove focus to/from component

| Escape | Close component |

Related Components

  • Modal - Overlay component for displaying content in a dialog that requires user interaction.
  • Tooltip - Overlay component for displaying helpful information when hovering over an element.
  • Popover - Overlay component for displaying rich content in a floating panel triggered by user interaction.
  • Dropdown - Overlay component for displaying a menu or list of options triggered by a button.

See Also