Dialogs & sheets
A dialog presents a scoped task in its own window, like saving a document. A sheet presents the same kind of task attached to the top of its parent context. Both share one surface: an opaque background, a 16px smoothed radius, and the window shadow with its 1px keyline.
When to use them
Use a dialog when the task stands alone, and a sheet when the task belongs to one view. For short confirmations, use alerts instead.
Preview
Anatomy
The window is 390px wide by default. Form rows use a two-column grid of labels and controls.
| Part | Value |
|---|---|
| Padding | 20px |
| Label column | 99px, right-aligned 13px labels in the secondary text color |
| Gutter | 8px |
| Control column | 223px |
| Row rhythm | 36px (24px controls with 12px gaps) |
| Title | 13px bold |
| Message | 11px, 14px line height |
| Title to message | 6px apart |
| Message to form | 20px |
| Last row to footer | 22px |
With a form, the title and message line up with the control column.
Tune the columns with --p-dialog-label-width, --p-dialog-field-width and --p-dialog-row-gap on the dialog.
| Class | Role |
|---|---|
.p-dialog | The window surface. Radius 16, 20px padding, window shadow plus 1px keyline. |
.p-dialog__title | 13px bold heading. |
.p-dialog__message | 11px supporting copy. |
.p-dialog__form | Two-column grid of labels and controls. |
.p-dialog__label | Right-aligned row label, secondary color. |
.p-dialog__control-group | A control plus a trailing companion, like a popup and its 24px disclosure button. |
.p-dialog__footer | Action row, right-aligned. |
.p-dialog__footer-leading | Pushes one action (usually destructive) to the left edge. |
.p-sheet | The same surface presented from the top of a host. |
.p-sheet-host | Positioning context for an attached sheet. |
Fields, selects, and buttons inside a dialog are the standard form controls and buttons. Nothing is restyled.
Expanded dialog
The expanded form is the full save panel. A sidebar runs down the leading edge, and the main pane stacks a form, a toolbar row, the file browser, and the footer.
| Part | Value |
|---|---|
| Size | 1000 by 448 |
| Sidebar | 210px, flush down the leading edge, traffic lights at the top |
| Sidebar toggle | 36px round button in the corner |
| Source rows | 24px tall, 8px corners |
| Form row pitch | 37px |
| Browser | Flush to the pane edges between two 1px keylines |
| Browser rows | 20px tall, zebra-striped, 8px rounded ends, inset 10px |
| Class | Role |
|---|---|
.p-dialog--expanded | 1000×448 window, no padding, sidebar and main pane side by side. |
.p-dialog__sidebar | Flush 210px sidebar. |
.p-dialog__sidebar-header | 52px band holding .p-traffic-lights (from windows.css) and the toggle. |
.p-dialog__sidebar-toggle | 36px round glass button, 8px from the top and trailing edge. |
.p-dialog__source-heading | 11px bold section title. |
.p-dialog__source | 24px source row. Mark the current one with aria-current. |
.p-dialog__source-icon | Accent-tinted row icon. |
.p-dialog__main | The main pane. |
.p-dialog__toolbar | Optional row of controls between the form and the browser. |
.p-dialog__browser | Scrolling file area between two 1px keylines. |
.p-dialog__files | The file table: 28px header, 20px zebra rows. .p-dialog__files-num right-aligns a column. |
Footer layout
Place the destructive action on the leading edge with .p-dialog__footer-leading, and end with Cancel then the primary action. This mirrors the order people expect on macOS: destruction far from confirmation.
<div class="p-dialog__footer">
<button class="p-button p-button-destructive p-dialog__footer-leading">Delete</button>
<button class="p-button" data-p-cancel>Cancel</button>
<button class="p-button p-button-primary">Save</button>
</div>
Opening a dialog
Dialogs run through the same modal manager as alerts. Add .p-modal next to .p-dialog, put it inside .p-modal-background, and open it with data-p-open-modal.
<button class="p-button p-button-primary" data-p-open-modal="#save-dialog">Save…</button>
<div class="p-modal-background">
<div
class="p-modal p-dialog"
id="save-dialog"
data-p-close-on-outside="true"
role="dialog"
aria-modal="true"
aria-hidden="true"
aria-labelledby="save-dialog-title"
>
<h2 class="p-dialog__title" id="save-dialog-title">Save this document?</h2>
<div class="p-dialog__form">
<label class="p-dialog__label" for="save-name">Save As:</label>
<input class="p-field" id="save-name" type="text" value="Untitled" />
</div>
<div class="p-dialog__footer">
<button class="p-button" data-p-cancel>Cancel</button>
<button class="p-button p-button-primary">Save</button>
</div>
</div>
</div>
<script src="path/to/puppertino/src/js/modals.js"></script>
Sheets
A sheet is the same surface sliding down from the top of its host. Inside a .p-sheet-host it attaches to that container. Inside .p-modal-background it attaches to the viewport. The entrance uses the 0.35s sheet timing.
<div class="p-modal-background">
<div
class="p-modal p-sheet"
id="rename-sheet"
role="dialog"
aria-modal="true"
aria-hidden="true"
aria-labelledby="rename-sheet-title"
>
<h2 class="p-dialog__title" id="rename-sheet-title">Rename “Quarterly Report”?</h2>
<div class="p-dialog__form">
<label class="p-dialog__label" for="rename-name">Name:</label>
<input class="p-field" id="rename-name" type="text" value="Quarterly Report" />
</div>
<div class="p-dialog__footer">
<button class="p-button" data-p-cancel>Cancel</button>
<button class="p-button p-button-primary">Rename</button>
</div>
</div>
</div>
Dark mode
The surface swaps to #1E1E1E and the shadow deepens to 57%, with the same black keyline. Sheets also get a 0.5px inner stroke of white at 20% so their edge holds against a dark window. In the expanded dialog the sidebar turns #161616, zebra stripes and dividers switch to white at 5% and 10%, and row icons brighten to #0A99FF. Titles and copy follow the dialog text tokens. Controls inside adapt on their own.
Accessibility
Dialogs and sheets are modal: role="dialog" with aria-modal="true", labelled by their title. The modal manager traps focus, closes on Escape, and returns focus to the trigger. With reduced motion, the scale and slide transitions reduce to fades. The surface is opaque in both appearances, so text contrast does not depend on the backdrop. With prefers-contrast: more the keyline becomes a solid 1px edge.