- Home
- Design system
- Containers
- Dialog
Dialog
Overview
Dialogs are usually contained within a ds-modal. If you use the html <dialog> element, no parent ds-modal element is needed.
The default maximum width is 800px and minimum width is 345px. Any dialog that exceeds the window height can be scrolled up in it’s entirety.
Construction
Dialogs consist of 3 distinct areas - Banner, Content and Footer.
-
Banner – including icon, title, description and text elements. All elements within the banner are optional, and the entire banner area can be omitted. See ds-banner for more details.
-
Section – the main content area of the dialog
-
Footer – including primary and secondary buttons, and text (optional). Buttons in dialogs are right aligned by default. The primary button must always be first in the source order (but will be display visually last). All elements within the footer are optional, and the entire footer area can be omitted.
Avoid using dialogs with long or complex forms.
The dialog footer should have no more than two buttons - the primary button (‘Update’, ‘Save’, ‘Delete’ etc.) and a secondary button (‘Cancel’ etc.).
Options
Basic usage
div element
Using html div element.
dialog element
Using the native html dialog element.
Visual states
Dialogs adhere to 4x preset visual states - alert, warning, success and info.
Loading state
A dialog can be triggered to display a loading state - where the dialog contents are hidden, and the replaced by a centered spinning loading icon – without affecting the dimensions of the dialog.
Additional options are available using Message state
Message state
Message state extends and can be used with Loading state. If a dialog has a data-attribute data-ds-message the dialog contents are hidden, and replaced by an icon and the text of the data-ds-message.
Size
Narrow
.ds-dialog --narrow (maximum width 550px)
Mid
.ds-dialog --mid (maximum width 675px)
Medium
.ds-dialog --medium (maximum width 900px)
Wide
.ds-dialog --medium (maximum width 1100px)
Position
Position of the dialog can be controlled on the parent ds-modal container.
Styles
Simple
Plain
Right panel
A dialog inside a ds-modal.--right or a dialog with the class ds-dialog.--right will display pinned to the right edge of the browser.
By default, if the content in the dialog is too long to fit on the screen, the entire dialog will be scrollable and the user will need to scroll down to see the footer.
Sticky footer/header
For a centered dialog, if either the header or footer has --sticky both header and footer will automatically be treated as sticky.
For a --right aligned dialog if the footer has the class --sticky the footer will always display on screen, pinned to the bottom of the browser window, and if the header has the class --sticky it will always display on screen pinned to the top of the browser window.
Examples
ui-ds-modal
Manifest
The component manifest describes this component's API — its modifiers, structure, data attributes, CSS custom properties, accessibility notes, and example markup. It is consumed by tooling such as AI assistants and code generators.
Latest version: https://assets.soracom.io/sds/latest/ds-modal/index.mjs