Dialog
A window overlaid on either the primary window, rendering the content underneath inert.
veritheme.js
JS init: automatic
Variants
Different dialog types for different use cases.
<!-- Trigger -->
<button onclick="openDialog('myDialog')">Open Dialog</button>
<!-- Dialog -->
<div id="myDialog" class="vt-dialog-overlay" role="dialog" aria-modal="true" aria-hidden="true">
<div class="vt-dialog">
<div class="vt-p-6">
<h3 class="vt-text-lg vt-font-semibold">Dialog Title</h3>
<p class="vt-text-sm vt-text-mains-quaternary vt-mt-1.5">Description text.</p>
</div>
<div class="vt-flex vt-justify-end vt-gap-2 vt-p-6 vt-pt-0">
<button onclick="closeDialog('myDialog')">Cancel</button>
<button onclick="closeDialog('myDialog')">Confirm</button>
</div>
</div>
</div>
Static Preview
Dialog content rendered inline.
Are you absolutely sure?
This action cannot be undone. This will permanently delete your account and remove your data from our servers.
Confirm: Destructive
Confirmation for irreversible actions like deleting data.
Delete item?
This action is permanent and cannot be undone. All associated data will be lost.
Confirm: Warning
Confirmation for potentially risky but reversible actions.
Unsaved changes
You have unsaved changes. Are you sure you want to leave? Your changes will be lost.
Confirm: Info
Standard confirmation for non-destructive actions.
Publish article?
This will make the article visible to everyone. You can unpublish it later.
Confirm: Centered
Centered confirmation dialog with icon.
Revoke access?
This user will immediately lose access to all shared resources.
Confirm: With Input
Requires typing to confirm the action.
Delete repository
This will permanently delete my-project and all of its data.
Anatomy
HTML structure of the Dialog component.
div.vt-dialog-overlay ← Full-screen backdrop
└── div.vt-dialog ← Dialog panel
├── div.vt-p-6 ← Header area
│ ├── h3 ← Title
│ └── p ← Description
├── div.vt-p-6.vt-pt-0 ← Body content (optional)
└── div.vt-flex.vt-justify-end ← Footer with action buttons
API Reference
All CSS classes available for the Dialog component.
| Class | Type | Description |
|---|---|---|
vt-dialog-overlay |
Base | Full-screen backdrop with centered layout |
vt-dialog |
Base | Dialog panel — rounded card with max-width |
vt-open |
State | Added to overlay to show the dialog |
Accessibility
Keyboard and screen reader support.
| Feature | Details |
|---|---|
| Role | Use dialog element or role="dialog" with aria-modal="true" |
| Label | Dialog must have aria-labelledby pointing to the title element |
| Focus trap | Focus is trapped inside the dialog while open, restored on close |
| Keyboard | Escape closes the dialog, Tab cycles through focusable elements |
| Close | Close button should have aria-label="Close dialog" |