Default
Edit Profile
Make changes to your profile here. Click save when you're done.
Installation
Install the component
templui add dialogAdd the JavaScript to your layout
@dialog.Script()Call this template in your base layout file (e.g., in the <head> section).
Examples
External Trigger
External Dialog
This dialog can be triggered from anywhere on the page.
Standalone Content
Standalone Dialog
This dialog content works without a wrapper component.
Perfect for dynamic content loading with HTMX or similar frameworks.
API Reference
Dialog
Main dialog wrapper component. Provides context for child components.
| Name | Type | Default |
|---|---|---|
Unique identifier for the dialog | | |
Additional CSS classes to apply to the dialog container | | |
Additional HTML attributes to apply to the dialog container | | |
Whether to disable closing the dialog by clicking outside | | |
Whether to disable closing the dialog with the ESC key | | |
Whether the dialog should be open initially | | |
Trigger
Element that triggers the dialog to open. Can be used inside Dialog wrapper or externally with For prop.
| Name | Type | Default |
|---|---|---|
Unique identifier for the trigger element | | |
Additional CSS classes to apply to the trigger | | |
Additional HTML attributes to apply to the trigger | | |
ID of a specific dialog to trigger (for external triggers) | | |
Content
Dialog content container. Can be used standalone for HTMX or inside Dialog wrapper.
| Name | Type | Default |
|---|---|---|
Dialog ID for standalone usage (when no context) | | |
Additional CSS classes to apply to the content | | |
Additional HTML attributes to apply to the content | | |
Whether to hide the default close button | | |
Initial open state for standalone usage | | |
Whether to disable automatic focusing of the first focusable element | | |
Header
Header section of the dialog.
| Name | Type | Default |
|---|---|---|
Unique identifier for the header element | | |
Additional CSS classes to apply to the header | | |
Additional HTML attributes to apply to the header | | |
Title
Dialog title component. Should be used inside Header.
| Name | Type | Default |
|---|---|---|
Unique identifier for the title element | | |
Additional CSS classes to apply to the title | | |
Additional HTML attributes to apply to the title | | |
Description
Dialog description component. Should be used inside Header.
| Name | Type | Default |
|---|---|---|
Unique identifier for the description element | | |
Additional CSS classes to apply to the description | | |
Additional HTML attributes to apply to the description | | |
Body
Body/content section of the dialog.
| Name | Type | Default |
|---|---|---|
Unique identifier for the body element | | |
Additional CSS classes to apply to the body | | |
Additional HTML attributes to apply to the body | | |
Close
Element that closes the dialog.
| Name | Type | Default |
|---|---|---|
Unique identifier for the close element | | |
Additional CSS classes to apply to the close element | | |
Additional HTML attributes to apply to the close element | | |
ID of the dialog to close (defaults to closest dialog if empty) | | |
JavaScript API
// Open a dialog programmatically
window.tui.dialog.open("dialog-id");
// Close a dialog
window.tui.dialog.close("dialog-id");
// Toggle dialog state
window.tui.dialog.toggle("dialog-id");
// Check if dialog is open (returns true/false)
const isOpen = window.tui.dialog.isOpen("dialog-id");