Modal / Dialog
Interrupts the page to ask for attention or input, and blocks everything behind it.
01Anatomy
6 parts. Select a number or a name to see what each part does.
01 · Backdrop
Dims the page behind it. It says: the rest isn’t available now.
- Required
- Yes
- Recommended
- Clicking it often closes non critical dialogs. Varies by design system.
02 · Surface
The panel that holds the dialog, above everything else.
- Required
- Yes
03 · Title
Says what the dialog is about. It is also its accessible name.
- Required
- Yes
- Recommended
- A question for a decision: “Delete project?”
04 · Close button
Dismisses without acting.
- Required
- No
- When
- Often left out when an answer is mandatory.
05 · Content
Explains the situation and the consequences, or holds a short form.
- Required
- Yes
06 · Actions
The choices: the main action plus a way out. The order varies by platform.
- Required
- Yes
- Recommended
- Name the action on the button: “Delete”, not “OK”.
Example spacing, measured on this drawing (16 px = 1 em). A common implementation, not a rule: values change from system to system. W and H are width and height, as in Figma: Hug follows the content, Fill takes the space of the parent.
Spacing is measured on the normal view: switch back to Normal to show it.
02Structure
- Modalcomponent set
- Backdroprectangleblack 60%
- Dialogauto layoutverticalfixed 320hugpadding 24gap 16
- Headerauto layouthorizontal
- Titletextfill
- CloseinstanceIcon Buttonboolean
- Bodyslot or text
- Footerauto layouthorizontalgap 8
- SecondaryinstanceButton
- PrimaryinstanceButton
| Property | Type | Values |
|---|---|---|
| Type | Variant | DefaultAlertForm |
| Size | Variant | SmallMediumLargeFull screen |
| Close | Boolean | truefalse |
| Footer | Boolean | truefalse |
| Body | Slot or Instance swap | a content component |
Keep the backdrop outside the Dialog component, so the dialog can also be placed on any frame.
03States
When it closes, focus goes back to the element that opened it.
04Variants
05Responsive behaviour
Centred, with a max width of about 480 to 640 px.
Full screen or a sheet from the bottom. Actions stack or take the full width.
There is no single correct anatomy: names, variants and properties differ from one design system to another. These are common structural models distilled from established design systems and accessibility guidance.
Proven methods for designing interfaces with AI. Every two weeks, in Italian.
Subscribe