Soracom

Design System
  1. Home
  2. Design system
  3. Containers
  4. 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.

  1. 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.

  2. Section – the main content area of the dialog

  3. 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.

html
Copy

dialog element

Using the native html dialog element.

html
Copy

Javascript controlled dialog element

html
Copy

Visual states

Dialogs adhere to 4x preset visual states - alert, warning, success and info.

html
Copy

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

Default

html
Copy

Alternative loading-refresh icon

html
Copy

Custom icon by adding any icon class

html
Copy

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.

html
Copy

Loading state with a message

html
Copy

You can set a custom icon

html
Copy

You can set a custom icon, with the loading state animation

html
Copy

Size

Narrow

.ds-dialog --narrow (maximum width 550px)

html
Copy

Mid

.ds-dialog --mid (maximum width 675px)

html
Copy

Medium

.ds-dialog --medium (maximum width 900px)

html
Copy

Wide

.ds-dialog --medium (maximum width 1100px)

html
Copy

Position

Position of the dialog can be controlled on the parent ds-modal container.

right positioned div element in ds-modal

html
Copy

right positioned javascript controlled dialog element in ds-modal

html
Copy

Styles

Simple

html
Copy

Plain

html
Copy

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.

Right aligned dialog with minimal content

html
Copy

Right aligned dialog with longer content

html
Copy

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.

html
Copy

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.

Sticky footer

html
Copy

Sticky header

html
Copy

Sticky header and footer

html
Copy

Examples

ui-ds-modal

html
Copy

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

index.mjs
Copy