Description
- A dialog displays content in context without transferring the user to a different page.
- It remains on screen and blocks the user's workflow until the user performs an action, cancels an action, or acknowledges something.
Figma library
Anatomy
Anatomy
Position
- Position a dialog in the middle center of the screen on top of all UI elements.
- Do not put a dialog on top of another dialog.
- Position buttons at the bottom right of a dialog. When using a pair of buttons, put the more expected action on the right and the less expected or canceling action on the left.
Size
Height
- The background mask should be fullscreen.
- The dialog height adjusts to the height of the content.
- The content section should fit at least 2 lines of text (approximately 120 pixels).
Width
- Dialog width sizes ensure dialogs are appropriately scaled for different content and screen sizes:
- Small: 540px
- Medium: 850px
- Large: 1080px
- Content section padding is available in sizes: None, XS, S, M, L.
Responsive
Responsive
States
Warning
States are visual indicators used to communicate a component’s interaction status. Learn more about commonly used component states in our General specs
A dialog does not have a hover, focus, or disabled state but the optional components in a dialog do.
Variations
Use header variations separately or together.
Use footer variations separately.
Typical
Confirmation
Destructive
Color mode
Best practices
- Modals are highly disruptive and block tasks until dismissed by the user. A dialog should only be used as a notification element if it provides the user with critical information immediately related to their task.
- For non-critical messaging, consider using an inline message instead of a dialog.
- Do not allow content behind a dialog to scroll.
- Hide or shade the background mask as required. Either:
- Hide the background mask so a user can see the background page, or
- Apply a dark tint to the background mask to hide the background page and bring attention to the dialog.
- When using a sticky footer, make sure it does not obstruct any focusable element on the page. This can cause issues for users who navigate using a keyboard.
- Use a cancel button and either a close label or close icon (X). Apply your choice consistently across your app.
- Only hide the header if you use the dialog component for the waiting state pattern.
Processing dialog used in waiting state pattern
Examples
Add previous transactions
Dialog with multiple features and mixed content
Dos and don'ts
Don't
Don't
Other names
Modal, modal dialog, corner dialog, prompt.
Technical example
Dialog component implemented in Carbon
Full-screen dialog component implemented in Carbon