Fine-tune light, shadows, borders, neumorphic
Light and shadows
Borders
Neumorphic
Overlays

Dialog <pm-dialog>

Modal dialog built on native <dialog> (focus containment, inert page, Esc, focus return).

Full screen
Open dialog

All deployments and environment variables will be removed.

Cancel Delete

Props

<script type="module"> import '@prismora/css'; import '@prismora/elements/button'; import '@prismora/elements/dialog'; </script> <pm-button commandfor="demo-dialog" command="--open">Open dialog</pm-button> <pm-dialog id="demo-dialog" heading="Delete project?" description="This cannot be undone."> <p>All deployments and environment variables will be removed.</p> <pm-button slot="footer" variant="ghost" tone="neutral" commandfor="demo-dialog" command="--close">Cancel</pm-button> <pm-button slot="footer" tone="danger">Delete</pm-button> </pm-dialog>

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

AttributeTypeDefaultDescription
mobileboolean—Native mobile patterns on phones; not set means as the ancestors say, false opts out.
openbooleanfalseOpen. Setting it opens or closes it (without pm-request-close).
headingstring—Title in the header; it names the dialog.
descriptionstring—Text under the title; it describes the dialog.
size'sm' | 'md' | 'lg' | 'full'—Width: sm, md (default), lg or full.
dismiss'any' | 'closerequest' | 'none'closerequestany = click outside or Esc · closerequest = Esc only · none = only explicit close.
mobile-variant
prop: mobileVariant
'sheet' | 'center' | 'fullscreen'—Phone layout when native mobile is on: bottom sheet (default), center, or fullscreen.
close-label
prop: closeLabel
stringCloseAccessible 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

EventReact / Svelte propDescription
pm-openonPmOpenOpened.
pm-closeonPmCloseClosed.
pm-request-closeonPmRequestCloseThe user asked to close it (cancelable: preventDefault() keeps it open). detail.reason says how.

Slots

SlotDescription
(default)Body.
footerActions.

CSS parts

PartDescription
::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