Skip to main content

Dialog

shadow

The Dialog element displays a dialog box with customizable content. It can be used, for example, to simply display information to the user or to request confirmation or cancellation of an action taken by the user. It is located above the application content and must be manually dismissed by the user in order to continue interacting with the application. The dialog can be displayed in different screen sizes and positions.

Basic usage

One way to display the 'Dialog' component is to use the 'Button' component with the 'dialog' attribute. For more information about the 'Button' component, go to Button.

Basic use with JavaScript

It is also possible to display the Dialog component using JavaScript. The onOpen() method, which is called on the wje-dialog element, is used to create a dialog box. This method displays a dialog box and returns its instance. To close a dialog box, you need to call the onClose() method on its instance.

Placement

The placement property specifies the placement of the dialog box on the screen. The default is slide-up. Other options are "stick-up", "fill-in", "slide-left", "slide-right".

Size

The size property adjusts the size of the dialog box on the screen. The default size is "small". Other options are "medium", "large" and "ex-large".

Dynamic content change

The content of the Dialog element can be easily changed by using a custom event and one of the beforeShow, afterShow, beforeHide or afterHide methods.

Registering a Blocking Event

The content of the Dialog element can be easily changed by using a custom event and one of the beforeShow, afterShow, beforeHide or afterHide methods.

When to use

Use wje-dialog to communicate status, result of actions, or required next steps immediately.

When not to use

Do not show multiple feedback channels for the same event unless there is a strong reason.

Accessibility

Announce status updates with suitable ARIA live regions and manage focus for modal interactions.

Best Practices

  • Match message severity (info/success/warning/error) to actual user impact.
  • Use confirmations only for destructive or hard-to-reverse actions.
  • Keep timeouts consistent so users have enough time to read messages.

Attributes and Properties

No properties available for this component.

Events

No events available for this component.

Methods

htmlDialogBody

DescriptionCreates the dialog body.
Signature(dialog: any) => void

close

DescriptionCloses the dialog.
Signature(e: any) => void

beforeOpen

DescriptionBefore the dialog opens.
Signature(dialog: any, trigger: any) => void

afterOpen

DescriptionAfter the dialog opens.
Signature(dialog: any, trigger: any) => void

beforeClose

DescriptionBefore the dialog closes.
Signature(dialog: any, trigger: any) => void

afterClose

DescriptionAfter the dialog closes.
Signature(dialog: any, trigger: any) => void

registerBlockingEvent

DescriptionRegisters an event listener on the provided button that triggers a blocking UI element and executes a given promise when the button is clicked.
Signature(button: HTMLElement, promise: Function) => void

updateHasFooter

DescriptionUpdates has footer using the latest component data.
Signature() => void

CSS Shadow Parts

NameDescription
dialogThe dialog wrapper.
headerThe header of the dialog.
bodyThe body of the dialog.
footerThe footer of the dialog.
closeThe close button of the dialog.

CSS Custom Properties

NameDescription
--wje-dialog-backgroundSpecifies the background color of the dialog.
--wje-dialog-colorDefines the text color within the dialog.
--wje-dialog-paddingControls the padding inside the dialog.
--wje-dialog-border-radiusSets the border radius for the dialog's corners.
--wje-dialog-box-shadowApplies a shadow effect to the dialog.

Slots

NameDescription
headerSlot for the header content.
bodySlot for the body content.
footerSlot for the footer content.