ELFBAR

Dialogs & Sheets

Modal overlays for confirmations, forms, and side panels.

Anatomy

Dialog

░░░░░ Overlay ░░░░░░░░░░░░░░░░░░░░░░░░░
░  ┌─── Dialog Container ───────────┐  ░
░  │  Title              [Back] [✕] │  ░  ← Header
░  │─────────────────────────────   │  ░
░  │  Body content                  │  ░  ← Body
░  │─────────────────────────────   │  ░
░  │  [Cancel]          [Confirm]   │  ░  ← Fixed Footer
░  └────────────────────────────────┘  ░
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  1. Overlay — Full-screen semi-transparent background, color --ds-color-special-mask, blocks underlying interactions
  2. Header — Title + optional back button + close button
  3. Body — Description text or form
  4. Fixed Footer — Fixed bottom bar supporting standard buttons or replacement-type footer

Usage Guidelines

✅ Do

  • Keep titles concise (e.g. "Confirm deletion" not "Are you sure you want to delete this item?")
  • Use red confirm buttons for destructive actions (destructive: true)
  • Always provide a cancel/close path — keep at least one exit
  • Keep forms inside dialogs simple (≤ 3 fields)

❌ Don't

  • Don't nest dialogs — use a multi-step flow instead
  • Don't show large amounts of content in a dialog — use a separate page
  • Don't use dialogs for non-urgent information — use Toast instead
  • Don't disable all closing paths — users need a way out

Interaction Behavior

StateDescription
OpenOverlay fades in + dialog scales up from center; focus moves to first interactive element
Content interactionFocus is trapped inside dialog (focus trap), Tab cycles within
Click overlayCloses dialog (when closable=true)
EscapeAlways available, closes dialog
CloseAnimation reverses; focus returns to trigger element; page scroll resumes

Accessibility

RequirementImplementation
Semantic rolerole="dialog" + aria-modal="true"
Title associationaria-labelledby linked to the title element ID
Content descriptionaria-describedby linked to the body
Focus trapTab cycles within the dialog; cannot escape
Focus restorationFocus returns to the trigger button on close
Scroll lockDisables <body> scroll on open (overflow: hidden)