Skip to main content

Dialog

Demo

zeta-web v0.6.6
Web Components

A reusable dialog or modal window with a customizable interface and functionality.

A dialog should popup either in response to user action or to get the users attention.

The dialog can be shown either as a modal or non-modal dialog. Modal is recommended for most uses. To show the dialog, call showModal() or show() method:

(document.querySelector("#dialog1") as ZetaDialog)?.showModal();

When shown as a modal, clicking the background barrier will close the modal by default; this can be changed with the closeOnBarrierClicked property.

Storybook

https://design.zebra.com/web/storybook/?path=/docs/components-dialog--docs

Slots

NameDescriptionType
defaultBody of dialog; typically text.text
iconA zeta-icon element. Size will be restricted based on dialog type.zeta-icon
confirmButton used in footer. Must be of type zeta-button.zeta-button
cancelButton used in footer. Must be of type zeta-button.zeta-button
otherButton used in footer. Must be of type zeta-button.zeta-button

Attributes

NameDescriptionTypeDefault
titleTitle of the dialog.undefinedundefined
centeredWhether header text should be centered.booleanfalse
initialOpenWhether the modal is initially open.booleanfalse
size"small" | "large""small"

Inherited Attributes

NameDescriptionTypeDefaultInherited From
roundedWhether the component is rounded or sharp.When true, rounded will set the border radius of the first child, and any children with class 'contourable-target' to --radius-minimal.Otherwise, this value will be --radius-none.boolean | undefinedtrueContourable
returnValueReturn value of the dialog.string""Popup
closeOnBarrierClickedWhether the modal should close when the background barrier is clicked.This is only relevant for modal dialogs, non-modal dialogs do not control their background barrier.booleantruePopup
openWhether component is open or closed.undefinedundefinedPopup

CSS Properties

NameDescription
--dialog-max-widthMax width of the dialog. Defaults to 480px.
--dialog-max-heightMax height of the dialog. Defaults to 80vh.

Figma

https://www.figma.com/design/JesXQFLaPJLc1BdBM4sisI/%F0%9F%A6%93-ZDS---Components?node-id=23954-93036