Modal
A card lifted over the page, which is covered and out of reach until the modal closes. A question with a yes and a no is its second piece, the Modal confirmation, which has its own page.
<Modal open={open} onOpenChange={setOpen}> <ModalContent> <ModalHeader> <ModalTitle>Edit agent</ModalTitle> <ModalDescription>Change how this agent is named and what it may do.</ModalDescription> </ModalHeader> <ModalBody> <ModalSection> <Field title="Name"> <Input defaultValue="Billing reconciler" /> </Field> </ModalSection> </ModalBody> <ModalFooter> <ModalClose render={<Button>Cancel</Button>} /> <Button color="primary" emphasis="high"> Save </Button> </ModalFooter> </ModalContent></Modal>Installation
import {
Modal,
ModalBody,
ModalClose,
ModalContent,
ModalDescription,
ModalFooter,
ModalHeader,
ModalSection,
ModalTitle,
ModalTrigger,
} from "@dome-systems/ds-dashboard/components";It is new. One screen draws it so far, the Probes page's Screenshot dialog. It is the design system's own (ds/components/modal.tsx), built on the primitives shadcn's Dialog and Alert Dialog use (Base UI's), with the Card's parts inside.
Anatomy
- 1 — The box. ModalContent: the card's fill, 12px corners, the deepest shadow.
- 2 — Title. The modal's name. 13px, medium, as a card's.
- 3 — Description. One line on what the modal is for.
- 4 — Body. What the modal holds, in sections. It pads nothing itself.
- 5 — Section. One group. It pads 12px above, 16px at its sides, and 16px under a control.
- 6 — Third button. Optional, at the left: a ghost.
- 7 — Second button. The neutral button, beside the main one.
- 8 — Main button. Always last, at the right.
Each part, and when it shows
| Part | What it is | When it shows |
|---|---|---|
| The cover | Black at 40% over the whole page, 60% in dark. In the code it is the backdrop. A click on it closes the modal. | Under an open modal. |
Modal | The root. It draws nothing: it holds whether the modal is open. | Never seen. |
ModalContent | The box, centered in the window: the card's fill, 12px corners, the deepest of the four shadows. 384, 576 or 1024px wide. | While the modal is open. |
ModalHeader | The top of the box, with a line under it. It pads 16px. | When it is given. A modal with no title has no name for a screen reader, unless ModalContent is given an aria-label. |
ModalTitle | The modal's name: 13px, medium. An icon before it, badges after it. | In the header. |
ModalDescription | One line under the title, in the secondary text color. | When it is given. |
| The X | A ghost button, 28px, over the header's top right corner. It closes the modal. | Only with close. Off by default. |
ModalBody | What the modal holds, in sections. It pads nothing itself. It scrolls when the modal is taller than the window. | When it is given. |
ModalSection | One group in the body: a title (15px), a description, then fields, Field groups, a paragraph, anything, 16px apart. It pads 12px above, 16px at its sides, and 16px under a control or 12px under text. It can draw a line under itself. | One for each group. A dialog with one group has one. |
ModalFooter | The bottom of the box, with a line over it. Three buttons at most, 28px tall. The last two are at the right, 8px apart; the main one is last. | When it is given. |
| The third button | A ghost, at the footer's left edge. The footer puts it there itself. | When the footer is given three buttons: it is the first of them. |
A header, a body and a footer
The usual modal. The header holds the title and, under it, a description. The body holds the content in a section, which pads it: 16px from the sides and from the footer's line, 12px under the header's. The footer holds the buttons, at the right: the neutral button, then the primary button. The header draws a line under itself and the footer a line over itself. With a title alone the header is 52px tall, with a description 64px. The footer is 60px.
<Modal open={open} onOpenChange={setOpen}> <ModalContent> <ModalHeader> <ModalTitle>Edit agent</ModalTitle> <ModalDescription>Change how this agent is named and what it may do.</ModalDescription> </ModalHeader> <ModalBody> <ModalSection> <Field title="Name"> <Input defaultValue="Billing reconciler" /> </Field> <Field title="Role"> <Select defaultValue="editor"> <SelectTrigger width="fixed"> <SelectValue /> </SelectTrigger> <SelectContent> <SelectItem value="admin">Admin</SelectItem> <SelectItem value="editor">Editor</SelectItem> <SelectItem value="viewer">Viewer</SelectItem> </SelectContent> </Select> </Field> </ModalSection> </ModalBody> <ModalFooter> <ModalClose render={<Button>Cancel</Button>} /> <Button color="primary" emphasis="high"> Save </Button> </ModalFooter> </ModalContent></Modal>What the title carries
The title is the Card's title: 13px, medium. icon sits before it, in the secondary text color. badges takes one badge or several after it: a status, a tag, a tally. Give each size="md", 20px: a badge at its default size is 24px, and makes the header 4px taller. Only the title's text is the modal's name for a screen reader: the badges are not read as part of it.
<ModalContent> <ModalHeader> <ModalTitle icon={Robot}>Edit agent</ModalTitle> </ModalHeader></ModalContent>
<ModalContent> <ModalHeader> <ModalTitle badges={ <Badge color="info" size="md"> Preview </Badge> } > Triggers </ModalTitle> </ModalHeader></ModalContent>
<ModalContent> <ModalHeader> <ModalTitle badges={ <> <Badge size="md">3</Badge> <Badge color="success" size="md"> Active </Badge> </> } > Members </ModalTitle> <ModalDescription>Everyone who can open this workspace.</ModalDescription> </ModalHeader></ModalContent>The X
close on ModalContent adds a ghost X, 28px, that floats over the header's top right corner. It is off by default. The designer's brief: “Generally, if it has a footer, it won't have a close… but it's there as an option.” With a title alone the X has 12px above it, beside it and below it, the equal space rule 9 asks for. Under a title with a description the header is taller and the X stays in the corner: 12px above and beside, 24px below. The header keeps its text clear of it. With no header it sits over the body's corner. The X is the last stop of the Tab key, after the footer.
<Modal open={open} onOpenChange={setOpen}> <ModalContent close> <ModalHeader> <ModalTitle icon={Key}>Signing key</ModalTitle> </ModalHeader> <ModalBody> <ModalSection ends="text"> This key signs every token an agent presents. Rotating it signs new tokens with a new key. </ModalSection> </ModalBody> </ModalContent></Modal>The footer: three buttons at most
The footer holds three buttons at most. The last two are at the right: the neutral button, then the main one, which is always last. A third, written first, lands on the left: a ghost, for an action beside the main choice, such as a reset. The footer places it itself. ModalClose makes any button close the modal. Footer buttons are 28px tall, the Card's limit for a header and a footer: one asked for at medium is drawn small. Controls in the body are not held to that: they are the size they ask for, 32px by default.
<Modal open={open} onOpenChange={setOpen}> <ModalContent> <ModalHeader> <ModalTitle>Filter runs</ModalTitle> </ModalHeader> <ModalBody> <ModalSection> <Field title="Role"> <Select defaultValue="editor">…</Select> </Field> </ModalSection> </ModalBody> <ModalFooter> <Button emphasis="ghost">Reset</Button> <ModalClose render={<Button>Cancel</Button>} /> <Button color="primary" emphasis="high"> Apply </Button> </ModalFooter> </ModalContent></Modal>At work
While the modal's request runs, the main button takes the Button's own loading, with loadingPlacement="before": the Loader, then the word, with no “…” after it. It does not fire again. The screen disables the button beside it. The modal has no state of its own for this: both are the Button's props.
<ModalFooter> <ModalClose render={<Button disabled={saving}>Cancel</Button>} /> <Button color="primary" emphasis="high" loading={saving} loadingPlacement="before"> {saving ? "Saving" : "Save"} </Button></ModalFooter>Sections
The body pads nothing. What it holds is in sections, and a section pads itself. A ModalSection is one group. It can have a title (15px, text-label-1, a step over a field's title) and a description under it. Then it holds whatever the group needs: fields, any number of Field groups, a paragraph, an alert. What it holds starts 12px under the title (under the description, when it has one) and is stacked 16px apart. It pads 12px above, 16px at its sides, and under it what its last thing needs: 16px after a control (an input, a button, anything with a box), 12px after text. It cannot see what it ends with, so it is told: ends="text" for a section that ends with a paragraph; control is the default. A dialog with one group is one section; its title is optional there, since the modal's title already names it. The designer's word on a form of two sections: each has a title.
<ModalContent> <ModalHeader> <ModalTitle>Edit agent</ModalTitle> </ModalHeader> <ModalBody> <ModalSection title="Agent" line="full"> <Field title="Name"> <Input defaultValue="Billing reconciler" /> </Field> <Field title="Role"> <Select defaultValue="editor">…</Select> </Field> </ModalSection> <ModalSection title="Owner" description="Who is asked when this agent needs a decision."> <Field title="Team"> <Input defaultValue="finance-ops" /> </Field> </ModalSection> </ModalBody> <ModalFooter> <ModalClose render={<Button>Cancel</Button>} /> <Button color="primary" emphasis="high"> Save </Button> </ModalFooter></ModalContent>The line between two sections
A section can draw a line under itself, before the next one. line="full" runs from edge to edge of the modal. line="inset" stops 16px from each side. With no line the two sections are apart by their padding alone. The last section in a body draws no line, whatever it is told: the footer has its own. Here the first section ends with text, so it pads 12px under it.
<ModalContent> <ModalHeader> <ModalTitle>Rotate signing key</ModalTitle> </ModalHeader> <ModalBody> <ModalSection title="What it does" ends="text" line="inset"> <p className="text-neutral-fg-secondary">This key signs every token an agent presents.</p> </ModalSection> <ModalSection title="The new key"> <Field title="Name"> <Input defaultValue="Signing key 2" /> </Field> </ModalSection> </ModalBody> <ModalFooter> <ModalClose render={<Button>Cancel</Button>} /> <Button color="primary" emphasis="high"> Save </Button> </ModalFooter></ModalContent>A section of text
A section can hold a title and a paragraph and nothing to fill. It ends with text, so it says ends="text" and pads 12px under it: a line of text is empty under its baseline, so its letters then sit about 16px from the footer's line, as a control's edge would.
<ModalContent> <ModalHeader> <ModalTitle>Rotate signing key</ModalTitle> </ModalHeader> <ModalBody> <ModalSection title="Before you rotate" ends="text"> <p className="text-neutral-fg-secondary"> Tokens already issued stay valid until they expire. New tokens are signed with the new key from the next call. </p> </ModalSection> </ModalBody> <ModalFooter> <ModalClose render={<Button>Cancel</Button>} /> <Button color="primary" emphasis="high"> Rotate </Button> </ModalFooter></ModalContent>Field groups in a section
A section holds as many Field groups as the form needs, each with its own title and as many fields as it needs, and anything between two of them: here a paragraph. A FieldGroup is the design system's own (title, description, a switch); the section only stacks what it is given. A form needs no part of its own: a <form className="contents"> inside ModalContent, around the header, the body and the footer, submits (see “A form that submits”).
<ModalContent size="md"> <ModalHeader> <ModalTitle>Edit agent</ModalTitle> </ModalHeader> <ModalBody> <ModalSection title="Access" line="full"> <FieldGroup title="Who can call it"> <Field title="Team"> <Input defaultValue="finance-ops" /> </Field> <Field title="Role"> <Select defaultValue="editor">…</Select> </Field> </FieldGroup> <p className="text-neutral-fg-secondary">A caller needs both: a team it belongs to, and a role on this agent.</p> <FieldGroup title="When it can run"> <Field title="Days"> <Input defaultValue="Monday to Friday" /> </Field> <Field title="Hours"> <Input defaultValue="8 AM to 6 PM" /> </Field> </FieldGroup> </ModalSection> <ModalSection title="Limits"> <Field title="Runs a day"> <Input defaultValue="200" inputMode="numeric" /> </Field> </ModalSection> </ModalBody> <ModalFooter> <ModalClose render={<Button>Cancel</Button>} /> <Button color="primary" emphasis="high"> Save </Button> </ModalFooter></ModalContent>Content that pads itself
Content that brings its own padding is not a section: setting rows (a Field group with orientation="horizontal", whose rows pad themselves; a vertical one does not, and goes in a section) and the ds Table. It goes in the body as it is and runs from edge to edge. A picture brings no padding and is not a section either: the screen pads it, the card inset on all four sides (p-card-inset), as the Probes page's Screenshot dialog does.
<ModalContent size="md"> <ModalHeader> <ModalTitle>Notifications</ModalTitle> </ModalHeader> <ModalBody> <FieldGroup orientation="horizontal" title="Email me when"> <Field title="A run fails" description="One email per failed run."> <Switch defaultChecked aria-label="A run fails" /> </Field> <Field title="A quota is reached" description="When an agent uses all of its allowance."> <Switch defaultChecked aria-label="A quota is reached" /> </Field> <Field title="A key is about to expire" description="Seven days before."> <Switch aria-label="A key is about to expire" /> </Field> </FieldGroup> </ModalBody> <ModalFooter> <ModalClose render={<Button color="primary" emphasis="high">Done</Button>} /> </ModalFooter></ModalContent>Sizes
size is the modal's width: sm 384px, the default, md 576px, lg 1024px. A modal is never wider than the window less 16px on each side. This column is 560px wide, so the md one here is drawn narrower than it is, and the lg one is not drawn at all: open them to see them at their size.
<ModalContent size="sm">…</ModalContent><ModalContent size="md">…</ModalContent><ModalContent size="lg">…</ModalContent>Taller than the window
A modal is never taller than the window less 16px above and below. When its content is taller, the body scrolls, and the header and the footer stay in place. It scrolls in the Scroll area: the thumb (6px, 4px in) shows under the pointer or while it scrolls, and a cover, 30px, lies over each edge the content runs on past, and only there. The body is then a stop of the Tab key, so the keyboard can scroll it. Running text, as here, ends where the room ends: the cover says there is more. The box here is 352px tall, as a short window would be.
<ModalContent size="md"> <ModalHeader> <ModalTitle badges={<Badge size="md">6</Badge>}>Glossary</ModalTitle> <ModalDescription>The words this product uses.</ModalDescription> </ModalHeader> <ModalBody> <ModalSection ends="text"> <div className="flex flex-col gap-3 text-neutral-fg-secondary">…six paragraphs…</div> </ModalSection> </ModalBody> <ModalFooter> <ModalClose render={<Button>Close</Button>} /> </ModalFooter></ModalContent>A form taller than the window
A body of fields that overflows is trimmed so that its last row in view is cut part-way, two thirds of it showing: a row that ends under the cover says there is more below. A row is a part of a Field (its title, its description, its control) or a table's row. The body is made that much shorter, so the modal is too. cutRow on the body is that share, a number from 0 to 1 (2 / 3 by default), or false for no trimming. The box here is 288px tall.
<ModalContent> <ModalHeader> <ModalTitle>Edit agent</ModalTitle> </ModalHeader> <ModalBody> <ModalSection>…three fields…</ModalSection> </ModalBody> <ModalFooter> <ModalClose render={<Button>Cancel</Button>} /> <Button color="primary" emphasis="high"> Save </Button> </ModalFooter></ModalContent>A form that submits
A form's fields are in the body and its submit button is in the footer. One <form> goes around both. It is given the class contents, so it draws no box of its own and the modal keeps its layout. The Enter key in a field then submits, and the browser checks a required field first. The screen closes the modal itself once the form is sent. Closing a modal removes what is in it: what was typed is gone when it opens again, unless the screen keeps it.
<Modal open={open} onOpenChange={setOpen}> <ModalContent> <form className="contents" onSubmit={(event) => { event.preventDefault(); addFile(new FormData(event.currentTarget).get("file")); setOpen(false); }} > <ModalHeader> <ModalTitle>New Cedar file</ModalTitle> </ModalHeader> <ModalBody> <ModalSection> <Field title="File name" description="The .cedar extension is added if missing."> <Input name="file" placeholder="my-rules.cedar" required /> </Field> </ModalSection> </ModalBody> <ModalFooter> <ModalClose render={<Button type="button">Cancel</Button>} /> <Button type="submit" color="primary" emphasis="high"> Add </Button> </ModalFooter> </form> </ModalContent></Modal>Opening it
ModalTrigger makes a button open the modal, and the modal keeps track of being open itself. A screen that opens it from somewhere else (a menu's row, the end of a request) decides that itself: it passes open and onOpenChange. When the modal closes, the focus goes back to what opened it.
<Modal> <ModalTrigger render={<Button>Edit agent</Button>} /> <ModalContent> <ModalHeader> <ModalTitle>Edit agent</ModalTitle> </ModalHeader> <ModalBody> <ModalSection> <Field title="Name"> <Input defaultValue="Billing reconciler" /> </Field> </ModalSection> </ModalBody> <ModalFooter> <ModalClose render={<Button>Cancel</Button>} /> <Button color="primary" emphasis="high"> Save </Button> </ModalFooter> </ModalContent></Modal>
<Button onClick={() => setOpen(true)}>Rename agent</Button><Modal open={open} onOpenChange={setOpen}> <ModalContent> <ModalHeader> <ModalTitle>Rename agent</ModalTitle> </ModalHeader> <ModalBody> <ModalSection> <Field title="Name"> <Input defaultValue="Billing reconciler" /> </Field> </ModalSection> </ModalBody> <ModalFooter> <ModalClose render={<Button>Cancel</Button>} /> <Button color="primary" emphasis="high"> Save </Button> </ModalFooter> </ModalContent></Modal>Three forms from the dashboard
Three forms that live in dialogs today, drawn again in the Modal with the Field, the Input and the Select. They are pictures of what a move would give: the screens themselves are not changed. Whether a form belongs in a modal at all is the first open question.
New Cedar file
One field. Today the sentence about the extension is the dialog's description. Here it is the field's own, under its title, and the dialog's X is gone: Cancel is the way out.
components/rules/rule-editor.tsx
Add quota
Four fields, two of them side by side. Today the unit is written in the limit's label, “Limit (Model tokens)”. Here it is in the field, after the number. Today Cancel is a ghost button here and an outlined one elsewhere: here it is the neutral button, as in every modal.
components/quotas/allowances-view.tsx
Create agent API key, then the key
Two steps. The first asks for a name and a gateway. The second shows the key once. Today the second is a wider dialog with an X, and a click outside it loses the key. Here it has no X, a click on the cover does not close it (disablePointerDismissal), and the key's field copies it. The Escape key still closes it. Its warning is the field's description until the Alert is in the design system.
components/agents/agent-keys-card.tsx
Keyboard and focus
Measured in a browser, on the real modal.
| Key | Does |
|---|---|
Enter, Space | On the button that opens it: opens the modal. |
(on opening) | The focus goes to the first control in the modal: the first field of a form, also when the body scrolls; the X when there is nothing else. Measured with a mouse and a keyboard, not on a touch screen. |
Tab | The next control. After the last one it goes back to the first: the focus stays in the modal. The X is last, after the footer. |
Shift + Tab | The previous control, and from the first one to the last. |
Escape | Closes it. The focus goes back to what opened it. |
Enter | In a field of a form: submits it, when the form is written as in “A form that submits”. |
While a modal is open, the page behind does not scroll and does not answer the pointer. A click on the cover closes the modal.
A Select opened in a modal draws its menu over the modal. The Escape key then closes the menu, and the modal stays open: a second press closes the modal. A modal opened over another modal was not tried.
Closing a modal removes what is in it. A click on the cover closes a Modal with a half-filled form, and what was typed is gone. disablePointerDismissal on Modal stops the cover from closing it. The Escape key still does.
Accessibility
A screen reader is told that a Modal is a dialog (the role dialog). It reads the title as the modal's name, and the description after it. The title is a level-2 heading. A badge beside the title is not part of the name.
While one is open the rest of the page is hidden from a screen reader. The X is named “Close”. A body that scrolls is a stop of the Tab key, so the keyboard can scroll it.
In the dashboard a modal opens and closes in 150ms: the cover fades, and the box fades and grows from 95% of its size. With reduced motion it appears and goes at once. This catalog does not load the dashboard's animation classes, so on this page a modal appears at once. What a screen reader says when one opens was not tested.
In the dashboard
One screen draws the Modal so far: the Probes page's Screenshot dialog (app/(authenticated)/[kind]/[scopeId]/probes/_components/browser-failure.tsx). This is what the rest of the dashboard draws today in its place, and what stays as it is.
Dialogs
35 dialogs in 30 files draw the older Dialog: a title, a body and buttons. All but the command palette have an X. Their title is 13px medium, as here, and their footer buttons are 32px.
components/ui/dialog.tsx
Side panels
A create or an edit form is a panel at the right of the page, which is not a modal: the page stays in reach. The Modal does not replace it.
components/ui/detail-panel.tsx
API Reference
Modal
The root. It draws nothing itself. Besides these, every prop of Base UI's Dialog root.
| Prop | Type | Default | Description |
|---|---|---|---|
open | boolean | — | Whether it is open, when the screen holds that itself. |
onOpenChange | (open, details) => void | — | Called when it asks to open or to close: its trigger, the Escape key, a click on the cover, the X, a ModalClose. details.reason says which. |
defaultOpen | boolean | false | Open from the start, when the modal holds its own state. |
disablePointerDismissal | boolean | false | A click on the cover no longer closes it. For a modal that shows something once, such as a new key. Base UI's own prop. |
ModalContent
The box, and the cover behind it. Besides these, every prop of Base UI's Dialog popup.
| Prop | Type | Default | Description |
|---|---|---|---|
size | "sm" | "md" | "lg" | "sm" | The width: 384, 576 or 1024px. |
close | boolean | false | Adds the X over the header's top right corner. |
ModalSection
One group in the body, and the part that pads. A section element, named by its title. Its children are stacked 16px apart. Besides these, every prop of a section.
| Prop | Type | Default | Description |
|---|---|---|---|
title | ReactNode | — | The group's name, over what it holds: 15px (text-label-1), a level-3 heading. A section alone in a modal needs none. |
description | ReactNode | — | A line under the title, in the secondary text. |
ends | "control" | "text" | "control" | What its last thing is, which sets the padding under it: 16px after a control (an input, a button, anything with a box), 12px after text. |
line | "full" | "inset" | — | A line under the section, before the next one: from edge to edge of the modal, or 16px in from each side. Not on the last section: the footer draws its own. |
The parts
The header, the title, the description, the body and the footer are the Card's parts under the Modal's names, and take what those take, with one exception: ModalBody takes no padding and no scroll. It pads nothing and always scrolls when its content is taller than its room.
| Part | What it is | Its own props |
|---|---|---|
ModalTrigger | Makes a button open the modal. | render: the button. |
ModalHeader | The Card's header. | padding, the same six steps, md by default. |
ModalTitle | The Card's title, and the modal's name. | icon; badges: one badge or several. No switch and no count: a tally is a badge. |
ModalDescription | The Card's description, and what a screen reader reads after the name. | icon. |
ModalBody | The Card's content, with no padding, in the Scroll area. | scrollArea (ScrollAreaSettings, the type the Table's takes): the scroll area's look, over the Modal's own (MODAL_SCROLL_AREA). cutRow (number | false): how much of the last row in view shows where the body overflows, from 0 to 1, two thirds by default (MODAL_CUT_SHARE); false for no trimming. Its other props, className included, go to the content and not to the box that scrolls: a height set there does nothing. |
ModalSection | A section element, named by its title. | See ModalSection above: title, description, ends, line. |
ModalFooter | The Card's footer, for three buttons at most. Its last two children are at the right, and a third, written first, at the left. | padding, md by default. |
ModalClose | Makes a button close the modal. | render: the button. |
ModalPreview | Draws the modals inside it in place, open, with no cover. This page and the playground use it. A screen never does. | container: the box to draw in. |
Tokens
In ds/tokens/modal.css. The inset is the Card's own token (--card-inset), and the lines are the border color (--border).
| Token | Value | What it sets |
|---|---|---|
--modal-background | The card's fill | The modal's fill. |
--modal-shadow | Stacking level 4 | The modal's edge and shadows: a 1px ring over two large drops. In dark the ring is the card's own. |
--modal-backdrop | Black at 40%, 60% in dark | The cover over the page (the backdrop). |
--modal-section-inset-top | The card's text inset, 12px | Above what a section holds. |
--modal-section-inset-bottom | The card inset, 16px | Under a section that ends with a control. |
--modal-section-inset-bottom-text | The card's text inset, 12px | Under a section that ends with text. |
--modal-width-sm | 384px | The width of sm, and of the Modal confirmation. |
--modal-width-md | 576px | The width of md. |
--modal-width-lg | 1024px | The width of lg. |
Rules
Written down
A dialog is for one verb and one outcome
The written rule keeps a dialog for a yes or no before something that cannot be undone, and for one field, such as a quick rename. It sends creating or editing a thing to a side panel or a page, where the list behind stays in view. The first open question asks how that fits forms in a modal.
From design/principles.md (Dialogs vs Sheets vs Detail Panel).
The main button is at the right, Cancel at its left
The submit button sits in the footer, at the right. Cancel or Close is the button at its left.
From design/principles.md (Forms).
A component that holds another passes it through
The footer's buttons are the screen's own Buttons, written as its children. The Modal has no prop for a button's color, its icon or its loading: those are the Button's.
From ui/ds/README.md (Components).
A button shows its own loading while its request runs
A main button at work is the Button's loading, set by the screen.
From .claude/rules/dashboard-ui.md (rule 6).
A header and a footer hold controls of 28px at most
The Modal's header and footer are the Card's, so they follow the Card's rule: 16px on every side, and controls no taller than 28px. The second open question asks whether a modal's buttons should be the exception.
From .claude/rules/dashboard-ui.md (rule 8), written for the Card.
A box that scrolls is the Scroll area
The body scrolls in the ds Scroll area, with no scrolling box of its own: its thumb, its cover over each edge the content runs on past, and, for a body of fields or table rows, a last row with two thirds of it in view.
From .claude/rules/dashboard-ui.md (rule 5).
A section pads 12px above what it holds, and under it what its last thing needs
Rule 8 gives a row 12px around text and 16px around a control. A section is a group, not a row, so each of its edges takes the value for what meets it: 12px above, where a section starts with a line of text; under it 16px for a control, 12px for text. The body itself pads nothing. A section that starts with something else is the open question below.
From ui/ds/README.md (Modal); .claude/rules/dashboard-ui.md (rule 8), written for a card's rows.
A control at a box's edge has equal space around it
Under a title alone the X has 12px above it, beside it and below it. Under a title with a description the header is 12px taller and the X stays in the corner, so it has 24px below it: there the rule does not hold.
From .claude/rules/dashboard-ui.md (rule 9).
It opens and closes in 150ms, with a zoom and a fade
The cover fades. The box fades and grows from 95% of its size. Measured with the dashboard's stylesheet, not on this page.
From design/principles.md (Motion).
The keyboard reaches everything the mouse reaches
Every control in a modal is a stop of the Tab key, and the Escape key closes it.
From design/principles.md (Interaction & Accessibility).
Open questions
Which forms may be a Modal?
Opendesign/principles.md keeps a dialog for a yes or no and for one field. It sends creating or editing a thing to a side panel, and names creating an API key as one.
“Inside is going to be forms and stuff.” Eleven of today's 35 dialogs are forms, the three drawn above among them.
Are the footer's buttons 28px, as in a card, or 32px?
Open28px: the footer is the Card's, and a card's footer holds small controls. A confirmation's two buttons are 28px too.
32px, in the Modal and in the confirmation. Today's dialogs also draw 32px buttons.
The title and the footer are the Card's, as you asked: your Modal page draws them differently, so is that still right?
Open“You copy the title” of the Card: 13px medium, over a 13px description. A separator under the header and one over the footer, on the card's fill: one white box.
A 17px medium title over a 12px description, in a header that pads 20px at the sides. The header and the body sit on a white panel with its own soft shadow, and the footer is on the gray box around it, with no line.
Should the modal have a row for an error, over the footer?
OpenNot built. An error about one field shows under that field, which the Field already does. An error about the whole request has no place in the modal: the screen shows a toast.
Two props, error-message and error-footer: a 40px row with an icon and a 12px sentence, over the footer. The confirmation has one too.
Are they Modal and Modal confirmation, or Dialog and Alert dialog?
OpenModal and Modal confirmation, your words. Two names that say they are one family.
Dialog and Alert dialog. The dashboard's older files carry those names today, and so does Base UI under both.
A section that starts with a box and not a line of text: 12px above it, or 16?
Open12px, whatever the section starts with. An alert or a bare control then sits 4px closer to the line above than to the sides. A picture alone is not a section today: its screen pads it 16px on all four sides.
A way to say what a section starts with, as ends says what it ends with.
Is running text cut part-way too?
OpenNo. A paragraph has no rows, so the body ends where the room ends and the cover alone says there is more.
“The paragraph might be super long, so I don't know about this two-thirds thing.”