Skip to Content
Archi-ui 1.0.25 is released 🎉

Dialog

Dialogs inform users about a task and can contain critical information, require decisions, or involve multiple tasks.

A Dialog is a type of model window that appears in front of app content to provie critical information or ask for a decision. Dialogs disable all app functionality when they appear, and rmain on screen until confirmed, dismissed, or a required action has been taken.

Dialogs are purposefully interruptive, so they should be used sparingly.

Introduction

Dialogs are implemented using a collection of related components:

  • Dialog: The parent component that renders the modal.
  • Dialog Title: a wrapper used for the title of a Dialog.
  • Dialog Actions: an optional container for Dialog’s Buttons.
  • Dialog Content: an optional container for displaying the Dialog’s content

Usage

import { Dialog, DialogTitle, DialogContent, DialogActions } from 'archi-ui'
<Dialog open={true}> <DialogTitle>Dialog Title</DialogTitle> <DialogContent dividers> <p>Lorem ipsum dolor sit, amet consectetur adipisicing elit. Quibusdam ipsa minus harum animi voluptates odio? Nulla odio, commodi id eligendi neque maxime illum. Est similique tempore rerum incidunt deserunt assumenda. Lorem ipsum dolor, sit amet consectetur adipisicing elit. Quasi sunt ullam libero illo optio excepturi amet commodi id dolor? Dicta exercitationem suscipit officia nisi! Fugit pariatur temporibus explicabo! Error, reiciendis.</p> </DialogContent> <DialogActions> <Button>Subscribe</Button> <Button>Cancel</Button> </DialogActions> </Dialog>

Basic Dialog

Seleted: user117@gmail.com

Alert Dialog

Alert are urgent interruptions, requiring acknowledgement, that inform the user about a situation.

Most alerts don’t need titles. They summarize a decision in a sentence or two by either:

  • Asking a question (for example “Delete this conversation?”)
  • Making statement related to the action buttons

Use title bar alerts only for high-risk situations, such as the potential loss of connectivity. Users should be able to understand the choices based on the title and button text alone.

If a title is required:

  • Use a clear question or statement with an explanation in the content area, such as “Erase USB storage?”.
  • Avoid apologies, ambiguity, or questions, such as “Warning!” or “Are you sure?”

Form dialogs

Form dialogs allow users to fill out form fields within a dialog. For example, if your site prompts for potential subscribers to fill in their email address, they can fill out the email field and touch ‘Subscribe’.

Customization

Here is an example of customizing the component.

The dialog has a close button added to aid usablility.

Full-screen dialogs

Here is an example of customizing the component.

The dialog has a close button added to aid usablility.

Optional sizes

You can set a dialog maximum width by using the maxWidth enumerable in combintion with the fullwidth boolean. When the fullwidth prop is true, the dialog will adapt based on the maxWidth value.

Scrolling log content

When dialogs belong too long for the user’s viewport or device, they scroll.

  • scroll=inside the content of the dialog scrolls within the dialog element.
  • scroll=outside the content of the dialog scrolls within the body element

Try the demo below to see what we mean:

Dialog API

API reference docs for the React Dialog component.

Props

NameTypeDefaultDescription
childrennode-Dialog children, usually the included sub-components.
classNamestring-Override or extend the styles applied to the component.
openbool-If true, the component is shown.
disableEscapeKeyDownboolfalseIf true, hitting escape will not fire the onClose callback.
fullscreenboolfalseIf true, the dialog is full-screen.
fullwidthboolfalseIf true, the dialog stretches to maxWidth. Notice that the dialog width grow is limited by the default margin.
maxWidth'xl' | 'lg' | 'md' | 'sm' | 'xs' | 'false''sm'Determine the max-width of the dialog. The dialog width grows with the size of the screen. Set to false to disable maxWidth.
onClosefunc-Callback fired when the component is requests to be closed.
Signature: function() => void.
onBackdropClickfunc-A function is triggred if provided when backdrop is been clicked.
BackdropPropsobject-Props applied to the Backdrop element.
hideBackdropboolfalseIf true, the backdrop is not rendered.
disableScrollLockboolfalseDisable the scroll lock behavior.
scroll'inside' | 'outside''inside'Determine the container for scrolling the dialog.

DialogActions API

API reference docs for the React DialogActions component.

Props

NameTypeDefaultDescription
childrennode-The content of the component.
classNamestring-Override or extend the styles applied to the component.
disableSpacingboolfalseIf true, the actions do not have additional margin.

DialogContent API

API reference docs for the React DialogContent component.

Props

NameTypeDefaultDescription
childrennode-The content of the component.
classNamestring-Override or extend the styles applied to the component.
dividersboolfalseDisplay the top and bottom dividers.

DialogTitle API

API reference docs for the React DialogTitle component.

Props

NameTypeDefaultDescription
childrennode-The content of the component.
classNamestring-Override or extend the styles applied to the component
Last updated on