Dark Light
System
Default LBBW Jira Confluence Source Code
Share
Playground

Dialog

<afp-dialog> Since 1.0.0 stable This component uses the light DOM, so its markup and styles are part of the regular document flow.

A modal dialog overlay that displays contextual content.

Dialog
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.
Close
Dialog

Examples #

Closeable #

Use the closeable attribute to show a close button in the dialog header and allow closing by clicking the backdrop or Escape. You can also use data-dialog="close" on elements to close the dialog.

Closeable
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.
Close
Closeable

Without Header #

Use the noHeader (noheader) attribute to create a dialog without the default header styling.

Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.
Close
Without Header

Use the noFooter (nofooter) attribute to create a dialog without the default footer styling.

Without Footer
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.
Close
Without Footer

Duration #

Use the duration attribute to set a custom animation duration in milliseconds. Set to 0 to disable animations.

Custom Duration
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.
Close
Custom Duration

Auto Close #

Use the autoClose attribute to automatically close the dialog after a specified duration in milliseconds.

Auto Close
This dialog will automatically close in 3 second(s).
Auto Close Dialog

Customization #

Use CSS custom properties to customize the dialog's appearance.

Customization
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.
Custom Dialog

Properties

Learn more about properties.

Name Description Reflects
open
Whether the dialog is open.
Type boolean
Default false
closeable
Allows closing by ESC key or clicking on the backdrop.
Type boolean
Default false
noHeader
noheader
Hides the header section.
Type boolean
Default false
noFooter
nofooter
Hides the footer section.
Type boolean
Default false
autoClose
autoclose
Duration in milliseconds after which the dialog automatically closes. Set to 0 to disable auto-close.
Type number
Default 0
duration
Animation duration in milliseconds for show/hide transitions.
Type number
Default 150

Methods

Learn more about using methods.

Name Description Arguments
show
Programmatically open the dialog.
-
hide
Programmatically close the dialog.
-

Events

Learn more about events.

Name Return Description
afp-show void
Emitted when the dialog is shown.
afp-after-show void
Emitted after the dialog has been shown and transitions complete.
afp-hide void
Emitted when the dialog is hidden.
afp-after-hide void
Emitted after the dialog has been hidden and transitions complete.

Slots

Learn more about slots.

Name Description
default
The main content slot for the dialog body.
header
The header slot for the dialog title or header content.
actions
The header actions slot for additional controls in the header.
close-icon
The close icon slot to customize the close button icon.
footer
The actions slot for footer buttons or actions.

CSS Parts

Learn more about CSS Parts.

Name Description Selector
base
The base part of the dialog (the `<dialog>` element).
::part(base)
wrapper
The content wrapper part inside the dialog.
::part(wrapper)
header
The header part of the dialog.
::part(header)
header-title
The title section of the header.
::part(header-title)
actions
The actions section in the header.
::part(actions)
close-button
The close button part.
::part(close-button)
content
The main content part of the dialog.
::part(content)
footer
The footer part of the dialog.
::part(footer)

CSS Custom Properties

Name Description Default
--afp-dialog-width
The width of the dialog.
30rem
--afp-dialog-scale
The scale transform of the dialog when shown.
0.9
--afp-dialog-close-icon-size
The size of the close icon.
--afp-font-size-m

Dependencies

The component automatically brings in the listed items, including any nested dependencies that may exist.

afp-button afp-icon

Importing

Using the bundle is the recommended method to include components. If you’d rather handle imports manually, you can use the code examples below.

import '@afp-design-system/core/dist/components/dialog/dialog.js';
Share
Create a link with a predefined theme that is automatically applied when the generated link is opened. Default LBBW Presentation Mode
Abort Copy Link