Modal
src/lib/components/modal.tsx·size (sm · md · lg) · kind (dialog · confirm) · header.description · footer (note · cancel · secondary · primary.destructive)
Guide
tentativeWhen to use
lg— a centred dialog that holds a whole summary, e.g. the review of every setting before a run starts (D2: Review stays a modal).sm— a short confirmation with two choices, e.g. Exit setup's “Discard changes?” (Discard / Keep editing).md— between the two; no screen uses it yet.
Do
- Keep the whole dialog inside the window: only the body scrolls; title and footer stay on screen.
- Render it through ShellOverlay (or AppShell
overlay) when it must cover the sidebar too. - Give the footer as data:
actionsin order with the primary last, plus an optionalnote(a status, or an error). - Open a separate small Modal for a confirmation rather than swapping the content of an open one.
- List what stops the primary action in the footer's
blockers, right above it (D11). - Show the primary action's own progress or outcome in the footer's
alert— Submitting (info), Submission failed (error, Retry), an uncertain timeout (warning, Retry) — so it sits beside the button that caused it, not at the top of a scrolled body. - Mark the safest action
initialFocusin a confirmation (“Keep editing”, never “Discard”); without one, focus opens on the body's first control. - When an action closes the dialog to take the user somewhere (a blocker link, Edit), move focus to that place — the dialog then leaves it there instead of returning it to the opener.
Don't
- No single fixed 950×873 size — pick a
size. - No free markup in the footer — a new kind of footer content is a new typed field.
- No more than one
primaryaction in a footer. - Don't add your own Escape or focus handling around it: it already moves focus in on open, keeps Tab inside, closes on Escape and returns focus on close.
Open
- The size set beyond sm · md · lg, and their exact widths (placeholders: 480 · 640 · 950px).
- Whether the footer needs more than actions, a note, blockers and one alert.
Related: Panel, Button, BlockerListSources: src/lib/components/modal.tsx · docs/decisions/0001-component-contracts.md · docs/product/configuration-redesign-plan.md
size=lg kind=dialog · footer note=muted, cancel, secondary, primary
size=md kind=dialog · description · note=error
size=sm kind=dialog · primary only, disabled
size=sm kind=dialog · no footer
size=sm kind=confirm · primary destructive
size=md kind=confirm · cancel, primary
size=lg · long body (scrolls; header and footer stay put)