Dialog <pm-dialog>
Modal dialog built on native <dialog> (focus containment, inert page, Esc, focus return).
All deployments and environment variables will be removed.
Overview
Open with el.show(), the open attribute, or an invoker: <button commandfor="id" command="--open">. Before the user closes it (Escape, a press outside, the close button, a swipe) it fires pm-request-close; cancel that to keep it open, for unsaved changes. hide() and open = false close it without asking. Responsive by default (fits narrow screens). With native mobile on (mobile here or on an ancestor such as <html mobile>, or setMobile(true)), phones get a bottom sheet you can swipe down; mobile-variant="center" keeps it centred and mobile-variant="fullscreen" fills the screen. Same markup on every device.
Attributes
| Attribute | Type | Default | Description |
|---|---|---|---|
mobile | boolean | — | Native mobile patterns on phones; not set means as the ancestors say, false opts out. |
open | boolean | false | Open. Setting it opens or closes it (without pm-request-close). |
heading | string | — | Title in the header; it names the dialog. |
description | string | — | Text under the title; it describes the dialog. |
size | 'sm' | 'md' | 'lg' | 'full' | — | Width: sm, md (default), lg or full. |
dismiss | 'any' | 'closerequest' | 'none' | closerequest | any = click outside or Esc · closerequest = Esc only · none = only explicit close. |
mobile-variantprop: mobileVariant | 'sheet' | 'center' | 'fullscreen' | — | Phone layout when native mobile is on: bottom sheet (default), center, or fullscreen. |
close-labelprop: closeLabel | string | Close | Accessible name of the close button (default "Close"). |
Also accepts the contextual attributes tone, surface, radius, density, motion, elevation. They are inherited from ancestors' data-* attributes.
Events
| Event | React / Svelte prop | Description |
|---|---|---|
pm-open | onPmOpen | Opened. |
pm-close | onPmClose | Closed. |
pm-request-close | onPmRequestClose | The user asked to close it (cancelable: preventDefault() keeps it open). detail.reason says how. |
Slots
| Slot | Description |
|---|---|
(default) | Body. |
footer | Actions. |
CSS parts
| Part | Description |
|---|---|
::part(dialog) | The native <dialog> box (size, padding, background). |
::part(title) | The heading. |
::part(close) | The close button. |
::part(body) | The body: the part that scrolls. |
::part(footer) | The footer. |
Methods
show(), hide(), toggle(), close()
Used in templates
OrdersCustomer 360InboxProject boardTeam and rolesBilling and invoicesUser profileAccount settingsProduct page