Content
- Title it with the task, in sentence case: Edit site, Invite people.
- Label the primary button with the verb from the title: Save changes, Send invites.
- Keep the body to what the task needs. A form that scrolls belongs on a page.
Asks for focused input or a decision in a panel over the page.
Open it, change its width, then close it with Escape, the scrim or a button. Focus goes back to Edit site.
<WildDialog
title="Edit site"
size="md"
footerLeft={<WildButton variant="destructive">Delete site</WildButton>}
footer={
<>
<WildButton variant="secondary">Cancel</WildButton>
<WildButton>Save changes</WildButton>
</>
}
onClose={close}
>
<WildFormField label="Site name">…</WildFormField>
</WildDialog>A title with a close button, the body, and a footer. The footer’s left slot holds the destructive action, away from the primary.
<WildDialog title="Edit site" size="md" @close="close">
<WildFormField label="Site name"> … </WildFormField>
<template #footer>
<WildButton variant="secondary">Cancel</WildButton>
<WildButton>Save changes</WildButton>
</template>
</WildDialog>Four, each tied to a kind of task. Pick by the task, not by how much text there is.
Move focus into the dialog when it opens, and back to the button that opened it when it closes. The × is a button named “Close dialog”.
| Key | What it does |
|---|---|
| Tab | Moves between the dialog’s controls, and stays inside it. |
| Escape | Closes it, the same as Cancel. |
| Prop | Type | Default | Description |
|---|---|---|---|
| title | string | — | The task, shown in the header. |
| size | 'sm' | 'md' | 'lg' | 'xl' | 'md' | Width: 384, 448, 672 or 896px. |
| footer | slot | — | The actions, right-aligned. |
| footerLeft | slot | — | The destructive action, or a footer control. |
| canvas | boolean | false | Grey body, for white cards inside. |
| @close | () => void | — | Draws the × and handles it. |
| Token | Value | Where it lands |
|---|---|---|
| --radius-3xl | 16px | The dialog corner. |
| --dialog-overlay | rgba(10, 9, 11, 0.5) | The scrim. |
| --shadow-xl | 0 20px 25px -5px …, 0 10px 10px -5px … | Elevation. |
| --z-index-modal | 500 | Above dropdowns; below popovers and toasts. |
| --color-bg-elevated | #FFFFFF | The surface. |
| --global-neutral-grey-400 | #ECECED | Header and footer rules; × pressed. |
| --global-neutral-grey-300 | #F1F1F1 | The × circle on hover. |
| --global-neutral-grey-900 / 1100 | #7F7D83 / #2D2B32 | The × at rest, then on hover. |