Skip to content
Overlay

Dialog

A modal dialog using the native <dialog> element. Includes focus trap, Escape to close, backdrop click to close, and smooth animations.

LlmDialog
WCAG AA0 deps

Demo

Live PreviewReact
Component Specification

The LlmDialog uses the native <dialog> element with built-in focus trapping and Escape key handling.

jsx
<LlmButton onClick={() => setOpen(true)}>Open Dialog</LlmButton>
<LlmDialog open={open} onOpenChange={setOpen} size="sm">
  <LlmDialogHeader>Confirm Delete</LlmDialogHeader>
  <LlmDialogContent>Are you sure? This cannot be undone.</LlmDialogContent>
  <LlmDialogFooter>
    <LlmButton variant="outline" onClick={() => setOpen(false)}>Cancel</LlmButton>
    <LlmButton variant="primary" onClick={() => setOpen(false)}>Delete</LlmButton>
  </LlmDialogFooter>
</LlmDialog>

API (Angular)

PropTypeDefaultDescription
openbooleanfalseControls dialog visibility
onOpenChange(open: boolean) => voidCalled when open state changes
closeOnBackdropbooleantrueClose when clicking the backdrop
size'sm' | 'md' | 'lg' | 'xl' | 'full''md'Max-width of the dialog

Composition parts

Dialog is composed from the parts below. Each part is its own component — drop the ones you don't need.

LlmDialogHeader

Title area. The text becomes the dialog's accessible name. Slot-only.

LlmDialogContent

Main body. Receives initial focus when the dialog opens. Slot-only.

LlmDialogFooter

Action row — typically Cancel / Confirm buttons. Slot-only.

Import

ts
import { LlmDialog, LlmDialogHeader, LlmDialogContent, LlmDialogFooter } from '@atelier-ui/angular';

Accessibility

ARIA roledialog (aria-modal="true")

KeyAction
EscapeClose the dialog. Focus is returned to the element that opened it.
Tab / Shift+TabCycle through focusable elements inside the dialog (focus is trapped).
  • Initial focus goes to the first tabbable element inside LlmDialogContent on open.
  • LlmDialogHeader is automatically linked as the accessible name via aria-labelledby.
  • Background content is inert while the dialog is open — screen readers only hear the dialog content.