← All Components
<mth-dialog>
Top-layer modal and non-modal dialog wrapping native <dialog> with default, alert, confirm, and prompt variants.
When NOT to use: Do not use <mth-dialog> for non-modal contextual hints; use <mth-popover> or <mth-tooltip>.
Live Interactive Preview
Publish @methane-ui/ui release artifacts with Sigstore provenance?
Ready · interact with <mth-dialog>, or toggle Theme, Direction (LTR/RTL), or props above.
Multi-Framework Playground & Snippets
<script type="module" src="@methane-ui/ui/dialog"></script>
<mth-dialog modal variant="default">Example</mth-dialog>import '@methane-ui/ui/dialog';
import '@methane-ui/react';
export function Example() {
return <mth-dialog modal variant="default">Example</mth-dialog>;
}<script setup lang="ts">
import '@methane-ui/ui/dialog';
</script>
<template>
<mth-dialog modal variant="default">Example</mth-dialog>
</template>import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import '@methane-ui/ui/dialog';
import { MthDialogDirective } from '@methane-ui/angular';
@Component({
standalone: true,
schemas: [CUSTOM_ELEMENTS_SCHEMA],
imports: [MthDialogDirective],
template: `<mth-dialog modal variant="default">Example</mth-dialog>`,
})
export class ExampleComponent {}<script lang="ts">
import '@methane-ui/ui/dialog';
import MthDialog from '@methane-ui/svelte/MthDialog.svelte';
</script>
<MthDialog modal variant="default">Example</MthDialog>Properties & Attributes
| Property | Attribute | Type | Default | Description |
|---|---|---|---|---|
open | open | boolean | false | Controls open visibility of the dialog. |
modal | modal | boolean | true | Opens as modal top-layer dialog with backdrop and focus trap when true. |
variant | variant | 'default' | 'alert' | 'confirm' | 'prompt' | "default" | Built-in semantic dialog preset (default | alert | confirm | prompt). |
label | label | string | "" | Accessible dialog title rendered in header. |
description | description | string | "" | Optional descriptive copy for alert/confirm/prompt dialogs. |
promptValue | prompt-value | string | "" | Current input value when variant="prompt". |
closeOnEscape | close-on-escape | boolean | true | Allows dismissing the dialog via the Escape key. |
Events
| Event | Detail Type | Description |
|---|---|---|
mth-open | void | Cancelable event fired before opening the dialog. |
mth-after-open | void | Fired once the entry transition settles. |
mth-close | { reason: string } | Cancelable event fired before closing the dialog. |
mth-after-close | { reason: string } | Fired once exit transition settles and focus restores. |
mth-confirm | { variant: string; value?: string } | Fired when the primary confirm/ok action button is clicked. |
mth-cancel | { variant: string } | Fired when the secondary cancel action button is clicked. |
APG Keyboard Matrix
| Key | Direction | When | Expected Behavior |
|---|---|---|---|
| Escape | both | open and closeOnEscape is true | dismisses dialog and restores focus |
Accessibility Checklist
| Category | Requirement | Verified By |
|---|---|---|
| aria | All aria-* IDREFs resolve within the same DOM root (ADR-003). | scanSameRootAria |
| focus | Focus ownership matches focusModel="host". | lint-plugin & spec-compiler |
| contrast | Renders legible borders, focus outlines, and selection indicators under forced-colors: active. | Playwright forced-colors matrix |
| keyboard | Implements all 1 APG keyboard transitions across LTR/RTL. | mth-dialog.spec.test.ts |
| states | Exposes ElementInternals CustomStateSet flags: :state(open), :state(modal). | Conformance suite |
| i18n | Routes 5 UI/ARIA strings through @methane-ui/core i18n catalog. | Locale context test |