Alert dialog
A modal pop-up designed to capture user attention for important actions or messages. It consists of three main components, which are Header, Content, and Footer. These elements together form a flexible and cohesive dialog structure that can accommodate different types of alerts or forms.
The key elements that define an Alert Dialog’s structure and function.
- Header: The sticky top section for long, scrollable modals, featuring a title, leading icon, and optional elements like a close icon or last updated status. A divider separates the header from the content below.
- Content: The main area of the dialog for forms, messages, or other information.
- Footer: The sticky bottom section, containing action buttons for user decisions, such as the primary action, secondary actions, and an optional terms & conditions disclaimer.
- Callout: Displays error messages if form validation fails, notifying the user of specific issues.
- Background Overlay: A 50% black opacity overlay behind the dialog, drawing attention to the alert and blocking background interactions.
Size
Desktop/Tablet
Fixed at the center of the screen. It has a maximum width of 400px for alert type and 800px for form type.
Mobile
Positioned at center of the screen. It stretches to fit the screen width, maintaining the 18px margins on all sides. It has a minimum width of 300px and maximum width of 100% relative to screen.
Section
Parts that make up the alert dialog.
Header
A sticky header for long, scrollable modals to keep the title and actions accessible at the top.
- Title: The main heading of the dialog.
- Optional Last Updated Status: Displays the last update timestamp if Close Icon is hidden.
- Tab: Optional tab navigation within the dialog.
- Optional Close Icon: Allows the user to close the dialog; if enabled, Last Updated Status is hidden.
- Divider: A separator between the header and content sections.
Footer
Positioned at the bottom, containing action buttons to guide users on their next steps.
- Primary Action: The main action button, always visible, typically on the right for desktop or centered for mobile.
- Action 1: Secondary action placed next to the primary action on the left.
- Cancel Action: Positioned next to Action 1, often used to cancel the primary action.
- Action 2: Located at the far left, used for additional actions like “Delete Draft.”
- Disclaimer text: Shown before proceeding with the primary action, such as "By submitting, you agree to Terms of Use and Privacy Policy.”
Footer Layout
- Side-by-Side: Typically used on desktop or larger modals where buttons can be displayed horizontally.
- Stacked: Used for mobile or smaller modals, where buttons are displayed in a vertical stack.
Footer Alignment
- Right: By default aligns actions to the right, usually for desktop and larger modals. This is most common because it helps users naturally locate the primary action (e.g., Submit) as the last button on the right, where the eye naturally rests.
- Left: Aligns actions to the left of the modal.
- Full: Stretches actions to fill the container, commonly used on mobile or smaller alert dialog.
Usage example
Forms
Used for applications, settings, or any interactive content requiring user input.
Alerts
- Success: Provides feedback to the user for successful actions or confirmations.
- Warning: Alerts the user about a potential issue or something that requires attention.
- Destructive: Used when a user is about to perform an irreversible action, like deletion.