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.

Attributes and Properties

headline

DescriptionSets the title of the dialog box.
Attributeheadline
Typestring
Defaultundefined

placement

DescriptionSets the location of the dialog box.
Attributeplacement
Type"slide-up" | "stick-up" | "fill-in" | "slide-left" | "slide-right"
Default"slide-up"

async

DescriptionIf true, allows the dialog to be loaded asynchronously.
Attributeasync
Typeboolean
Defaultfalse

closeHidden

DescriptionIf true, the close button will be hidden.
Attributeclose-hidden
Typeboolean
Defaultfalse

trigger

DescriptionThe name of the event that triggers the opening of the dialog.
Attributetrigger
Typestring
Defaultundefined

size

DescriptionSets the size of the dialog box.
Attributesize
Type"small" | "medium" | "large" | "ex-large"
Default"small"

Events

No events available for this component.

Methods

OnOpen

DescriptionOpens a dialog box.
Signature(e?: Event) => void

close

DescriptionCloses the dialog box.
Signature(e?: Event) => void

BeforeOpen

DescriptionIt is called before the dialogue is opened. Can be overridden to trigger custom logic.
Signature(dialog: HTMLElement, trigger: Event) => Promise<void>

afterOpen

DescriptionIt calls for the opening of a dialogue. Can be overridden to run custom logic.
Signature(dialog: HTMLElement, trigger: Event) => Promise<void>

beforeClose

DescriptionIt is called before the dialogue is closed. Can be overridden to trigger custom logic.
Signature(dialog: HTMLElement, trigger: Event) => Promise<void>

afterClose

DescriptionIt is called after the dialogue is closed. Can be overridden to trigger custom logic.
Signature(dialog: HTMLElement, trigger: Event) => Promise<void>

registerBlockingEvent

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

CSS Shadow Parts

NameDescription
headerDialogue header section.
bodiesThe main content area of the dialogue.
footerDialogue footer section.
closeButton element to close the dialog.
headlineHeading text element.
header-actionsContainer for header actions.

CSS Custom Properties

NameDescription
--wje-dialog-widthDialog window width
--wje-dialog-heightHeight of the dialog box
--wje-dialog-border-radiusRounding the edges of the dialog box
--wje-dialog-border-widthDialog box border width
--wje-dialog-border-styleDialog box border style
--wje-dialog-border-colorDialog box border colour
--wje-dialog-margin-topTop edge of the dialog box
--wje-dialog-margin-bottomBottom edge of the dialog
--wje-dialog-margin-startLeft edge of the dialog box
--wje-dialog-margin-endRight edge of the dialog box
--wje-dialog-paddingInternal indentation of dialogue sections
--wje-backdrop-opacityBackground transparency in open dialogue
--wje-backdropBackground colour in open dialogue
--wje-dialog-header-actions-gapSpace between action items in the header
--wje-dialog-headline-font-sizeFont size of the heading
--wje-dialog-headline-font-weightFont thickness of the heading
--wje-dialog-headline-letter-spacingSpace between the letters of the heading
--wje-dialog-headline-text-transformHeadline text transformation

Slots

NameDescription
``The main content of the dialog box.
headerContent placed in the dialogue header area.
footerContent located in the dialogue footer area.