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.
<button class="vt-btn vt-btn-primary" onclick="veritheme.openDialog('dialog1')">
Edit Profile
</button>
<button class="vt-btn vt-btn-danger" onclick="veritheme.openDialog('dialog2')">
Delete Account
</button>
<button class="vt-btn vt-btn-bordered" onclick="veritheme.openDialog('dialog3')">
Success Dialog
</button>
<button class="vt-btn vt-btn-danger" onclick="veritheme.openDialog('dialog-confirm-delete')">
Confirm Delete
</button>
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.
<div class="vt-dialog vt-max-w-md">
<div class="vt-dialog-header">
<div class="vt-dialog-heading">
<h3 class="vt-dialog-title">Are you absolutely sure?</h3>
<p class="vt-dialog-description">This action cannot be undone. This will permanently delete your account and remove your data from our servers.</p>
</div>
</div>
<div class="vt-dialog-footer">
<button class="vt-btn vt-btn-bordered">
Cancel
</button>
<button class="vt-btn vt-btn-danger">
Continue
</button>
</div>
</div>
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.
<div class="vt-dialog vt-max-w-sm vt-mx-auto">
<div class="vt-dialog-header">
<div class="vt-icon-badge vt-dialog-icon vt-dialog-icon-danger">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" fill="none" class="vt-icon-badge-icon" aria-hidden="true">
<path d="M18.8516 16.3743L19.5 6H4.5L5.14839 16.3743C5.315 19.0401 5.39831 20.373 6.26426 21.1865C7.13021 22 8.46571 22 11.1367 22H12.8633C15.5343 22 16.8698 22 17.7357 21.1865C18.6017 20.373 18.685 19.0401 18.8516 16.3743Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"></path><path d="M15.5 6H21M15.5 6L15.3721 4.97683C15.1595 3.2762 13.7139 2 12 2C10.2861 2 8.84047 3.2762 8.6279 4.97683L8.5 6M15.5 6H8.5M3 6H8.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"></path><path d="M9.5 11V17M14.5 11V17" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"></path>
</svg>
</div>
<div class="vt-dialog-heading">
<h3 class="vt-dialog-title">Delete item?</h3>
<p class="vt-dialog-description">This action is permanent and cannot be undone. All associated data will be lost.</p>
</div>
</div>
<div class="vt-dialog-footer">
<button class="vt-btn vt-btn-bordered">
Cancel
</button>
<button class="vt-btn vt-btn-danger">
Delete
</button>
</div>
</div>
Confirm: Warning
Confirmation for potentially risky but reversible actions. vt-dialog-warning on the dialog turns its primary action orange.
Unsaved changes
You have unsaved changes. Are you sure you want to leave? Your changes will be lost.
<div class="vt-dialog vt-max-w-sm vt-mx-auto vt-dialog-warning">
<div class="vt-dialog-header">
<div class="vt-icon-badge vt-dialog-icon vt-dialog-icon-warning">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" fill="none" class="vt-icon-badge-icon" aria-hidden="true">
<path d="M13.9248 21H10.0752C5.44476 21 3.12955 21 2.27636 19.4939C1.42317 17.9879 2.60736 15.9914 4.97574 11.9985L6.90057 8.75333C9.17559 4.91778 10.3131 3 12 3C13.6869 3 14.8244 4.91777 17.0994 8.75332L19.0243 11.9985C21.3926 15.9914 22.5768 17.9879 21.7236 19.4939C20.8704 21 18.5552 21 13.9248 21Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"></path><path d="M12 9V13" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"></path><path d="M12.125 16.75H12M12.25 16.75C12.25 16.8881 12.1381 17 12 17C11.8619 17 11.75 16.8881 11.75 16.75C11.75 16.6119 11.8619 16.5 12 16.5C12.1381 16.5 12.25 16.6119 12.25 16.75Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"></path>
</svg>
</div>
<div class="vt-dialog-heading">
<h3 class="vt-dialog-title">Unsaved changes</h3>
<p class="vt-dialog-description">You have unsaved changes. Are you sure you want to leave? Your changes will be lost.</p>
</div>
</div>
<div class="vt-dialog-footer">
<button class="vt-btn vt-btn-bordered">
Stay
</button>
<button class="vt-btn vt-btn-primary">
Discard
</button>
</div>
</div>
Confirm: Success
Confirmation that finishes something good. vt-dialog-success on the dialog turns its primary action green.
Ready to launch?
All checks passed. The release goes live for every user as soon as you confirm.
<div class="vt-dialog vt-max-w-sm vt-mx-auto vt-dialog-success">
<div class="vt-dialog-header">
<div class="vt-icon-badge vt-dialog-icon vt-dialog-icon-success">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" fill="none" class="vt-icon-badge-icon" aria-hidden="true">
<path d="M5 13.2592L7.58583 15.9568C8.2525 16.6523 8.58583 17 9.00004 17C9.41425 17 9.74759 16.6523 10.4143 15.9568L19 7" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"></path>
</svg>
</div>
<div class="vt-dialog-heading">
<h3 class="vt-dialog-title">Ready to launch?</h3>
<p class="vt-dialog-description">All checks passed. The release goes live for every user as soon as you confirm.</p>
</div>
</div>
<div class="vt-dialog-footer">
<button class="vt-btn vt-btn-bordered">
Not yet
</button>
<button class="vt-btn vt-btn-primary">
Launch
</button>
</div>
</div>
Confirm: Info
Standard confirmation for non-destructive actions.
Publish article?
This will make the article visible to everyone. You can unpublish it later.
<div class="vt-dialog vt-max-w-sm vt-mx-auto">
<div class="vt-dialog-header">
<div class="vt-icon-badge vt-dialog-icon vt-dialog-icon-info">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" fill="none" class="vt-icon-badge-icon" aria-hidden="true">
<circle cx="12" cy="11.9999" r="10" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"></circle><path d="M12 15.9999L12 11.9999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"></path><path d="M11.875 8.24994L12 8.24994M11.75 8.24994C11.75 8.11187 11.8619 7.99994 12 7.99994C12.1381 7.99994 12.25 8.11187 12.25 8.24994C12.25 8.38801 12.1381 8.49994 12 8.49994C11.8619 8.49994 11.75 8.38801 11.75 8.24994Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"></path>
</svg>
</div>
<div class="vt-dialog-heading">
<h3 class="vt-dialog-title">Publish article?</h3>
<p class="vt-dialog-description">This will make the article visible to everyone. You can unpublish it later.</p>
</div>
</div>
<div class="vt-dialog-footer">
<button class="vt-btn vt-btn-bordered">
Cancel
</button>
<button class="vt-btn vt-btn-primary">
Publish
</button>
</div>
</div>
Confirm: Centered
Revoke access?
This user will immediately lose access to all shared resources.
<div class="vt-dialog vt-dialog-centered vt-max-w-xs vt-mx-auto">
<div class="vt-dialog-header">
<div class="vt-icon-badge vt-icon-badge-lg vt-dialog-icon vt-dialog-icon-danger">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" fill="none" class="vt-icon-badge-icon" aria-hidden="true">
<path d="M11.9922 8L11.9922 12" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"></path><path d="M12.1172 15.75L11.9922 15.75M12.2422 15.75C12.2422 15.8881 12.1303 16 11.9922 16C11.8541 16 11.7422 15.8881 11.7422 15.75C11.7422 15.6119 11.8541 15.5 11.9922 15.5C12.1303 15.5 12.2422 15.6119 12.2422 15.75Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"></path><path d="M20.9922 11.1835V8.28041C20.9922 6.64041 20.9922 5.82041 20.5881 5.28541C20.184 4.75042 19.2703 4.49068 17.4429 3.97122C16.1944 3.61632 15.0938 3.18875 14.2145 2.79841C13.0156 2.26622 12.4161 2.00012 11.9922 2.00012C11.5682 2.00012 10.9688 2.26622 9.7699 2.79841C8.89057 3.18875 7.79002 3.61632 6.54152 3.97122C4.71411 4.49068 3.80041 4.75042 3.3963 5.28541C2.99219 5.82041 2.99219 6.64041 2.99219 8.28041V11.1835C2.99219 16.8086 8.05496 20.1836 10.5861 21.5195C11.1932 21.8399 11.4968 22.0001 11.9922 22.0001C12.4876 22.0001 12.7911 21.8399 13.3982 21.5195C15.9294 20.1836 20.9922 16.8086 20.9922 11.1835Z" stroke="currentColor" stroke-linecap="round" stroke-width="1.5"></path>
</svg>
</div>
<div class="vt-dialog-heading">
<h3 class="vt-dialog-title">Revoke access?</h3>
<p class="vt-dialog-description">This user will immediately lose access to all shared resources.</p>
</div>
</div>
<div class="vt-dialog-footer">
<button class="vt-btn vt-btn-bordered">
Cancel
</button>
<button class="vt-btn vt-btn-danger">
Revoke
</button>
</div>
</div>
Confirm: With Input
Requires typing to confirm the action.
Delete repository
This will permanently delete my-project and all of its data.
<div class="vt-dialog vt-max-w-sm vt-mx-auto">
<div class="vt-dialog-header">
<div class="vt-dialog-heading">
<h3 class="vt-dialog-title">Delete repository</h3>
<p class="vt-dialog-description">This will permanently delete <strong class="vt-text-foreground-primary">my-project</strong> and all of its data.</p>
</div>
</div>
<div class="vt-dialog-body">
<div class="vt-field">
<label class="vt-label" for="confirm-repo">
Type <strong>my-project</strong> to confirm
</label>
<input type="text" placeholder="my-project" class="vt-input" id="confirm-repo">
</div>
</div>
<div class="vt-dialog-footer">
<button class="vt-btn vt-btn-bordered">
Cancel
</button>
<button class="vt-btn vt-btn-danger">
I understand, delete
</button>
</div>
</div>
Guidelines
Publish article?
This will make it visible to everyone.
Publish article?
This will make it visible to everyone.
Delete item?
This action is permanent and cannot be undone.
Tip
Press ⌘K to open the command palette.
Anatomy
div.vt-dialog-overlay ← Full-screen backdrop
└── div.vt-dialog ← Dialog panel
├── div.vt-dialog-header ← Header row
│ ├── div.vt-icon-badge.vt-dialog-icon ← Icon (optional)
│ └── div.vt-dialog-heading ← Title + description
│ ├── h3.vt-dialog-title
│ └── p.vt-dialog-description
├── div.vt-dialog-body ← Body content (optional)
└── div.vt-dialog-footer ← Action buttons
API Reference
| Class | Type | Description |
|---|---|---|
vt-dialog-overlay |
Base | Full-screen backdrop with centered layout |
vt-dialog |
Base | Dialog panel — a rounded card, a column of header, body and footer, up to 480px wide |
vt-open |
State | Added to overlay to show the dialog |
vt-dialog-header |
Part | Top row: optional icon badge and the heading; 24px padding |
vt-dialog-heading |
Part | Title over description, with no gap between them; takes the rest of the row |
vt-dialog-title |
Part | Title — Heading/SM |
vt-dialog-description |
Part | Supporting text — Body/SM, muted |
vt-icon-badgevt-dialog-icon |
Part | Icon badge in brand tint; tones vt-dialog-icon-info / -success / -warning / -danger |
vt-dialog-body |
Part | Any content (fields, text) under the header, 16px between items |
vt-dialog-footer |
Part | Actions (vt-btn), aligned to the end |
vt-dialog-centered |
Modifier | Stacks and centers the header, stretches the actions |
vt-dialog-success |
Intent | On vt-dialog: the footer's vt-btn-primary turns success-fill (green), as an Alert's action does |
vt-dialog-warning |
Intent | On vt-dialog: the footer's vt-btn-primary turns warning-fill (orange) |
Accessibility
| 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" |