Skip to main content
Version: latest
Works everywhere

Drawer works in both server and client environments. Always use the standard import (e.g. @prokodo/ui/drawer) — the library detects the runtime automatically.

Drawer

Drawer renders an off-canvas side panel that slides in from the left, right, top, or bottom. Focus is trapped while open and released on close.

Live demo →

Overview

import { Drawer } from "@prokodo/ui/drawer"
;<Drawer open={menuOpen} placement="right" onClose={() => setMenuOpen(false)}>
<nav>...</nav>
</Drawer>

Import

import { Drawer } from "@prokodo/ui/drawer"

CSS:

import "@prokodo/ui/drawer.css"

Props

PropTypeDefaultRequiredDescription
openbooleanControls drawer visibility.
anchor"left" | "right" | "top" | "bottom""right"Side from which the drawer slides in.
titlestringDrawer title text.
titlePropsHeadlinePropsProps forwarded to the title Headline component.
fullscreenbooleanfalseRender the drawer as full-screen.
actionsReactNodeAction buttons rendered in the drawer footer.
childrenReactNodeDrawer body content.
onChange(open: boolean) => voidCalled when the drawer open state changes.
refDrawerRefRef to imperative handle for programmatic control.
classNamestringCSS class on root element.

See src/components/drawer/Drawer.model.ts for the full DrawerProps type.


Design Tokens

Customise via CSS custom properties on :root or a scoped ancestor.

TokenDefaultDescription
--pk-drawer-bgvar(--pk-color-surface)Drawer panel background
--pk-drawer-bordervar(--pk-color-border)Header bottom border color
--pk-drawer-shadowvar(--elevation-1)Panel box-shadow
--pk-drawer-backdrop-bgrgba(0, 0, 0, 0.5)Backdrop overlay color
--pk-drawer-z-index1302Panel z-index
--pk-drawer-paddingvar(--pk-space-md)Header / content padding

AIC Note

Use the standard import path in application code:

import { Drawer } from "@prokodo/ui/drawer"

No separate /client or /lazy import selection is required in consumer code.

AIC components also support a priority flag for critical above-the-fold elements. This is most visible on Image (native preloading via <link rel="preload"> for above-the-fold content).


WCAG 2.2 Status

CriterionNameStatusNote
1.3.1Info and Relationships (A)✅ FulfilledSemantic structure (headings, lists, labels, landmarks) must be conveyed programmatically via HTML or ARIA.
2.1.1Keyboard (A)✅ FulfilledAll functionality must be operable via keyboard alone, without requiring specific timing.
2.1.2No Keyboard Trap (A)🔍 Manual reviewKeyboard focus must never become trapped inside a component; users must always be able to navigate away using standard keys.
2.4.3Focus Order (A)🔍 Manual reviewThe keyboard focus sequence must preserve meaning and operability in the complete page integration context.
2.4.7Focus Visible (AA)🔍 Manual reviewA visible keyboard focus indicator must be present on every interactive element. Verify against the applied product theme.
2.4.11Focus Not Obscured (Min.) (AA)🔍 Manual reviewThe focused component must not be fully hidden by sticky headers, overlays, or other positioned page elements.
4.1.2Name, Role, Value (A)✅ FulfilledName, role, and state of all interactive UI components must be programmatically determinable via native HTML semantics or ARIA.
4.1.3Status Messages (AA)🔍 Manual reviewStatus messages (loading, success, error, progress) must reach assistive technologies without a focus change (aria-live or role='status').

Test coverage: 2 jest-axe assertion(s) across 6 test file(s) · 4 ARIA attribute occurrence(s) in source scan. Criteria marked 🔍 require manual verification in the final product integration and theme context.

Storybook

👉 Open Drawer in Storybook


Source

src/components/drawer/Drawer.model.ts