Component v1.1.0 Overlays

Drawer

Modal edge panel for focused navigation, filters, forms, and supporting workflows.

API Stable 2.1 WCAG notes Ready Dark mode
Selector
ui-drawer
Package
@ngnova/ui/drawer

Import

Standalone Tailwind v4
import { UiDrawerComponent, UiDrawerHeaderDirective, UiDrawerFooterDirective } from '@ngnova/ui/drawer';

Usage & variants

Live examples use the public ui-drawer API, paired with the exact snippet a product team would paste into an Angular app.

API Reference

Filter side panel

Modal edge panel for focused navigation, filters, forms, and supporting workflows.

Opens a focus-trapped panel from the right edge.

Production guidance

Use these notes to decide when the component belongs in a product workflow and what to verify before shipping.

When to use

Use for filters, navigation, compact forms, or supporting tasks that need more room than a Popover.

Watch for

Widths and heights remain within the viewport and use public drawer size tokens for brand customization.

Product recipes

Apply Drawer in distinct, copyable product scenarios—not just an isolated component state.

Filter side panel

A right-edge drawer keeps a focused filter workflow separate from the results page.

Angular template ui-drawer-recipe.example.html
1
2
3
4
5
<ui-drawer [(open)]="filtersOpen" titleId="filters-title" position="right">
  <span uiDrawerHeader id="filters-title">Filters</span>
  <form><!-- controls --></form>
  <button uiDrawerFooter type="button" (click)="filtersOpen = false">Apply</button>
</ui-drawer>

Mobile navigation

Move application navigation into a modal drawer on small screens and label it by purpose.

Angular template ui-drawer-recipe.example.html
1
2
3
4
5
6
7
8
9
<ui-button (pressed)="navigationOpen.set(true)">Open navigation</ui-button>
<ui-drawer
  side="left"
  ariaLabel="Application navigation"
  [open]="navigationOpen()"
  (openChange)="navigationOpen.set($event)"
>
  <nav><a href="/dashboard">Dashboard</a><a href="/projects">Projects</a></nav>
</ui-drawer>

API Reference

Inputs and outputs are semver-sensitive public API. Keep examples aligned with this table.

Inputs

open false
boolean

Controlled visibility state.

position 'right'
'start' | 'end' | 'left' | 'right' | 'top' | 'bottom'

Viewport edge from which the panel is presented. start and end follow the text direction; left and right are physical.

size 'md'
'sm' | 'md' | 'lg'

Tokenized width for side drawers or height for vertical drawers.

drawerId generated
string

Stable ID for the dialog panel.

titleId generated
string

ID of the visible projected heading.

descriptionId ''
string

Optional descriptive content ID.

ariaLabel ''
string

Direct accessible name when no visible title is used.

closeAriaLabel 'Close drawer'
string

Localized label for the close button.

initialFocus ''
string

CSS selector for the first element to focus.

closeOnBackdrop true
boolean

Allows backdrop click dismissal.

closeOnEscape true
boolean

Allows Escape dismissal.

restoreFocus true
boolean

Returns focus to the previously focused control.

uiDrawerHeader recommended
directive

Projects the visible drawer heading.

uiDrawerFooter optional
directive

Projects footer actions.

Outputs

openChange boolean

Requests controlled visibility changes.

opened void

Emits when the drawer opens.

closed void

Emits when the drawer closes.

backdropClick MouseEvent

Emits for every backdrop click.

escapeKeyDown KeyboardEvent

Emits when enabled Escape dismissal occurs.

Accessibility

  • The panel uses role="dialog" and aria-modal="true" and requires ariaLabel or a visible titleId.
  • Focus moves inside after opening, remains trapped while open, and returns to the previous control after close.
  • Background document scrolling is locked until the last open drawer closes.

Keyboard behavior

  • Tab and Shift+Tab wrap through enabled focusable controls inside the topmost drawer.
  • Escape closes only the topmost drawer when closeOnEscape is enabled.

Testing guidance

  • Use UiDrawerHarness to inspect title, open state, edge position, and close the panel.
  • Test focus entry and wrap, focus restoration, accessible naming, configured dismissal, scroll cleanup, every edge, and every size.