Dialog
A window over the page that takes attention until people finish or close it.
In Multi-brand
See it live
npm run storybookWhen to use it
In Multi-brand: Change a plan.
- Use it when: People must decide or finish something before going back: a short form, an important choice.
- Not when: A short status (toast), extra detail on the page (accordion), or a side panel that should not block the page (sheet).
Instead:
- Sheet: A side panel; the page stays in view.
- Toast: Does not interrupt.
- Alert dialog: Confirms something that cannot be undone.
How Multi-brand uses it
Words
- Shared structure: object, state, next step.
- Brand tone lives in headlines and marketing copy, not in errors.
- Errors and confirmations read the same in every brand.
- Use: Get started, Plan, Order. Avoid: Brand-specific words in errors, Jargon.
The labels components use, from the voice tokens:
content.action.commit: Savecontent.action.cancel: Cancelcontent.action.destroy: Removecontent.action.retry: Try againcontent.action.empty-action: Get started
See Voice and tone for the whole voice.
Accessibility and keyboard
| Keyboard | What happens | Not |
|---|---|---|
| undefined | Escape closes it. | undefined |
| undefined | Tab stays inside while it is open. | undefined |
Test before you ship:
- It is a dialog with a title; the page behind is hidden from screen readers. undefined
- Focus moves in when it opens and back to the trigger when it closes. undefined
Use it in code
npx open-ds add dialog
The component reads only component keys and semantic tokens, so it follows the brand and mode on <html>.
Tokens it reads
Dialog reads 20 tokens of its own, each an alias of a semantic token. Each row is one part: its own token, the semantic it aliases, and the value it ends at. Change a semantic and every component that reads it follows; override one of Dialog's tokens to change Dialog alone.
Multi-brand decides what changes when you switch theme. Here a switch changes colors, type and shape, so the marked rows differ between its brands and between light and dark; everything else holds steady.
| Part | Its token and the semantic it aliases | Value |
|---|---|---|
| Shared | ||
| Overlay background Changes with theme | component.overlay.backgroundcolor.surface.raisedvar(--overlay-background) | Aster Lightslate-deep.light.0:#FFFFFFAster Darkslate-deep.dark.100:#1E293BBirch Lightslate-deep.light.0:#FFFFFFBirch Darkslate-deep.dark.100:#1E293BCoral Lightslate-deep.light.0:#FFFFFFCoral Darkslate-deep.dark.100:#1E293B |
| Overlay radius Changes with theme | component.overlay.radiusradius.containervar(--overlay-radius) | Aster Lightradius.8:0.5remAster Darkradius.8:0.5remBirch Lightradius.16:1remBirch Darkradius.16:1remCoral Lightradius.20:1.25remCoral Darkradius.20:1.25rem |
| Overlay shadow Changes with theme | component.overlay.shadowelevation.overlayvar(--overlay-shadow) | Aster Lightshadow.overlay:0px 12px 32px 0px #0F172A29Aster Darkshadow.overlay-dark:0px 12px 32px 0px #00000080Birch Lightshadow.overlay:0px 12px 32px 0px #0F172A29Birch Darkshadow.overlay-dark:0px 12px 32px 0px #00000080Coral Lightshadow.overlay:0px 12px 32px 0px #0F172A29Coral Darkshadow.overlay-dark:0px 12px 32px 0px #00000080 |
| Overlay scrim Changes with theme | component.overlay.scrimcolor.surface.scrimvar(--overlay-scrim) | Aster Lightblack.light.scrim:#0000008CAster Darkblack.dark.scrim:#000000B3Birch Lightblack.light.scrim:#0000008CBirch Darkblack.dark.scrim:#000000B3Coral Lightblack.light.scrim:#0000008CCoral Darkblack.dark.scrim:#000000B3 |
| Content | ||
| Gap | component.dialog.content.gapspace.gap.groupvar(--dialog-content-gap) | space.24:1.5rem |
| Padding | component.dialog.content.paddingspace.inset.containervar(--dialog-content-padding) | space.24:1.5rem |
| Text Changes with theme | component.dialog.content.labelcolor.text.primaryvar(--dialog-content-label) | Aster Lightslate-deep.light.900:#0F172AAster Darkslate-deep.dark.900:#F8FAFCBirch Lightslate-deep.light.900:#0F172ABirch Darkslate-deep.dark.900:#F8FAFCCoral Lightslate-deep.light.900:#0F172ACoral Darkslate-deep.dark.900:#F8FAFC |
| Dialog | ||
| Border width | component.dialog.border-widthborder-width.defaultvar(--dialog-border-width) | border-width.1:1px |
| Border Changes with theme | component.dialog.bordercolor.border.defaultvar(--dialog-border) | Aster Lightslate-deep.light.200:#E2E8F0Aster Darkslate-deep.dark.100:#1E293BBirch Lightslate-deep.light.200:#E2E8F0Birch Darkslate-deep.dark.100:#1E293BCoral Lightslate-deep.light.200:#E2E8F0Coral Darkslate-deep.dark.100:#1E293B |
| Corner Changes with theme | component.dialog.radiusradius.badgevar(--dialog-radius) | Aster Lightradius.4:0.25remAster Darkradius.4:0.25remBirch Lightradius.999:9999pxBirch Darkradius.999:9999pxCoral Lightradius.999:9999pxCoral Darkradius.999:9999px |
| Padding | component.dialog.paddingcomponent-spacing-map.x1var(--dialog-padding) | space.4:0.25rem |
| Text Changes with theme | component.dialog.labelcolor.text.secondaryvar(--dialog-label) | Aster Lightslate-deep.light.700:#334155Aster Darkslate-deep.dark.500:#CBD5E1Birch Lightslate-deep.light.700:#334155Birch Darkslate-deep.dark.500:#CBD5E1Coral Lightslate-deep.light.700:#334155Coral Darkslate-deep.dark.500:#CBD5E1 |
| Sunken Changes with theme on hover | component.dialog.sunkencolor.surface.sunkenvar(--dialog-sunken) | Aster Lightslate-deep.light.100:#F1F5F9Aster Darkslate-deep.dark.100:#1E293BBirch Lightslate-deep.light.100:#F1F5F9Birch Darkslate-deep.dark.100:#1E293BCoral Lightslate-deep.light.100:#F1F5F9Coral Darkslate-deep.dark.100:#1E293B |
| Size | component.dialog.sizesize.iconvar(--dialog-size) | size.16:1rem |
| Gap | component.dialog.gapspace.gap.tightvar(--dialog-gap) | space.8:0.5rem |
| Gap 2 | component.dialog.gap-2space.gap.defaultvar(--dialog-gap-2) | space.12:0.75rem |
| Font family Changes with theme | component.dialog.font-familytype.heading.font-familyvar(--dialog-font-family) | Aster Lightfont.family.inter:Inter, system-ui, sans-serifAster Darkfont.family.inter:Inter, system-ui, sans-serifBirch Lightfont.family.plus-jakarta-sans:"Plus Jakarta Sans", system-ui, sans-serifBirch Darkfont.family.plus-jakarta-sans:"Plus Jakarta Sans", system-ui, sans-serifCoral Lightfont.family.poppins:Poppins, system-ui, sans-serifCoral Darkfont.family.poppins:Poppins, system-ui, sans-serif |
| Text size | component.dialog.font-sizetype.heading.font-sizevar(--dialog-font-size) | font.size.20:1.25rem |
| Weight | component.dialog.font-weighttype.heading.font-weightvar(--dialog-font-weight) | font.weight.600:600 |
| Font size 2 | component.dialog.font-size-2type.body.font-sizevar(--dialog-font-size-2) | font.size.16:1rem |