Overlay
Dialog
A window over the page, modal or not, that takes focus in, keeps it inside and returns it when it closes.
WAI-ARIA tested
Import
main.ts
import { Dialog } from '@vitral/vue';Basic
The header names the dialog; the footer is the button band.
Position
The dialog sits in the centre, along an edge or in a corner, and slides in from there.
Maximizable
A button fills the viewport with the dialog; its name switches between Maximize and Restore.
Modeless
`modal: false` keeps the page usable: no mask, no focus trap, no scroll lock. Escape still closes it.
Overlays inside
Open the select, then press Escape: the select closes first, the dialog stays.
API
Read from packages/vue/src/components/Dialog/types.ts, so it says what the component actually accepts.
Props
| Name | Type | Description |
|---|---|---|
| header | string | The title; it names the dialog. Without one, name it with `aria-label` or `aria-labelledby`. |
| modal | boolean | Dim and block the page, trap focus and lock scrolling. Defaults to true. |
| closable | boolean | Show the close button. Defaults to true. |
| dismissableMask | boolean | Close on a press on the mask. |
| closeOnEscape | boolean | Defaults to true. |
| position | DialogPosition | — |
| maximizable | boolean | Add a button that fills the viewport with the dialog. |
| blockScroll | boolean | Lock the page's scroll even when the dialog is not modal. |
| showHeader | boolean | Defaults to true. |
| appendTo | string | `'body'` (the default), `'self'` to render in place, or a selector. |
Plus pt, dt and unstyled from BaseProps, see pass-through and unstyled mode.
Emits
| Event | Payload | Description |
|---|---|---|
| show | — | — |
| hide | — | — |
| after-hide | — | After the closing animation, once the dialog has left the page. |
| maximize | — | — |
| unmaximize | — | — |
Slots
| Name | Slot props | Description |
|---|---|---|
| default | — | — |
| header | — | Replaces the title text; it still names the dialog. |
| footer | — | — |
| closeicon | — | — |
| maximizeicon | (props: { maximized: boolean }) | — |