Skip to content

Forms and overlays

Which overlay for which job: modal, drawer, alert dialog, toast.

Forms and overlays

Request 7f3a…c21

FilteredNov 30, 2026 14:02:11 UTC
Reason
Floor not met
Floor
$1.20
Best bid
$0.94
Partner
Partner 2
Placement
Homepage video
Latency
84 ms

Revoke the reporting API key?

3 integrations use this key and stop receiving data at once. This cannot be undone.

Invite sent

ops@example.com can log in for 7 days.

Markup
<div class="xg-stack">
<div class="xg-row">
<button class="xg-btn" type="button" data-xg-open="p-modal">
<svg class="xg-icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false">
<path d="M12 5v14"/>
<path d="M5 12h14"/>
</svg>Add demand partner</button>
<button class="xg-btn xg-btn--secondary" type="button" data-xg-open="p-drawer">Open request log entry</button>
<button class="xg-btn xg-btn--danger" type="button" data-xg-open="p-confirm">Revoke API key</button>
<button class="xg-btn xg-btn--ghost" type="button" data-xg-toast='{"title":"Settings saved","tone":"success","action":"Undo"}'>Save with Undo</button>
</div>
<dialog class="xg-modal" id="p-modal" aria-labelledby="p-modal-t">
<form method="dialog" style="display:contents">
<div class="xg-modal__header">
<h2 class="xg-modal__title" id="p-modal-t">Add demand partner</h2>
<button class="xg-btn xg-btn--ghost xg-btn--icon xg-btn--sm" data-xg-close aria-label="Close">
<svg class="xg-icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false">
<path d="M18 6 6 18"/>
<path d="m6 6 12 12"/>
</svg>
</button>
</div>
<div class="xg-modal__body">
<div class="xg-field">
<label class="xg-label" for="pm-name">Partner name</label>
<input class="xg-input" id="pm-name" placeholder="e.g. Partner 4">
</div>
<div class="xg-field">
<label class="xg-label" for="pm-ep">Endpoint URL</label>
<input class="xg-input" id="pm-ep" type="url" placeholder="https://">
</div>
<div class="xg-field">
<label class="xg-label" for="pm-proto">Protocol</label>
<select class="xg-select" id="pm-proto">
<option>OpenRTB 2.6</option>
<option>OpenRTB 2.5</option>
<option>VAST 4.2</option>
</select>
</div>
<label class="xg-switch">
<input type="checkbox" role="switch" checked>Send test traffic first</label>
</div>
<div class="xg-modal__footer">
<button class="xg-btn xg-btn--secondary" value="cancel" data-xg-close>Cancel</button>
<button class="xg-btn" value="ok">Add partner</button>
</div>
</form>
</dialog>
<dialog class="xg-drawer" id="p-drawer" aria-labelledby="p-drawer-t">
<form method="dialog" style="display:contents">
<div class="xg-modal__header">
<h2 class="xg-modal__title" id="p-drawer-t">Request 7f3a…c21</h2>
<button class="xg-btn xg-btn--ghost xg-btn--icon xg-btn--sm" data-xg-close aria-label="Close">
<svg class="xg-icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false">
<path d="M18 6 6 18"/>
<path d="m6 6 12 12"/>
</svg>
</button>
</div>
<div class="xg-modal__body">
<div class="xg-row">
<span class="xg-badge xg-badge--warning">Filtered</span>
<span class="xg-text-sm xg-text-muted">Nov 30, 2026 14:02:11 UTC</span>
</div>
<dl class="xg-dl">
<dt>Reason</dt>
<dd>Floor not met</dd>
<dt>Floor</dt>
<dd>$1.20</dd>
<dt>Best bid</dt>
<dd>$0.94</dd>
<dt>Partner</dt>
<dd>Partner 2</dd>
<dt>Placement</dt>
<dd>Homepage video</dd>
<dt>Latency</dt>
<dd>84 ms</dd>
</dl>
</div>
<div class="xg-modal__footer">
<button class="xg-btn xg-btn--secondary" type="button">
<svg class="xg-icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false">
<rect x="8" y="8" width="13" height="13" rx="2"/>
<path d="M16 8V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h3"/>
</svg>Copy raw JSON</button>
</div>
</form>
</dialog>
<dialog class="xg-modal xg-modal--sm" id="p-confirm" role="alertdialog" aria-labelledby="p-confirm-t" aria-describedby="p-confirm-d">
<form method="dialog" style="display:contents">
<div class="xg-modal__header">
<span class="xg-alert-dialog__icon" aria-hidden="true">!</span>
<h2 class="xg-modal__title" id="p-confirm-t">Revoke the reporting API key?</h2>
</div>
<div class="xg-modal__body">
<p id="p-confirm-d">3 integrations use this key and stop receiving data at once. This cannot be undone.</p>
</div>
<div class="xg-modal__footer">
<button class="xg-btn xg-btn--secondary" value="cancel" autofocus>Cancel</button>
<button class="xg-btn xg-btn--danger" value="revoke">Revoke key</button>
</div>
</form>
</dialog>
<div style="display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,320px),1fr));gap:16px;align-items:start;padding:24px;border-radius:var(--xg-radius-card);background:var(--xg-color-surface-scrim)">
<div class="xg-modal xg-modal--static" role="dialog" aria-labelledby="ps-t">
<div class="xg-modal__header">
<h2 class="xg-modal__title" id="ps-t">Invite a teammate</h2>
</div>
<div class="xg-modal__body">
<div class="xg-field">
<label class="xg-label" for="ps-e">Email</label>
<input class="xg-input" id="ps-e" value="ops@example.com">
</div>
<div class="xg-field">
<label class="xg-label" for="ps-r">Role</label>
<select class="xg-select" id="ps-r">
<option>Viewer</option>
<option>Editor</option>
<option>Admin</option>
</select>
</div>
</div>
<div class="xg-modal__footer">
<button class="xg-btn xg-btn--secondary" type="button">Cancel</button>
<button class="xg-btn" type="button">Send invite</button>
</div>
</div>
<div class="xg-toast xg-toast--success" style="animation:none">
<span class="xg-toast__dot" aria-hidden="true">
</span>
<div class="xg-toast__body">
<p class="xg-toast__title">Invite sent</p>
<p>ops@example.com can log in for 7 days.</p>
</div>
</div>
</div>
</div>

The rules that hold between the parts

  • Modal: a short task that must finish before going on (up to about five fields).
  • Drawer: details or edits about a row while the list stays visible; filters with many fields.
  • Alert dialog: only to confirm something destructive or costly. Say the consequence with numbers.
  • Toast: confirm what happened, with Undo where possible, instead of asking “Are you sure?” first.
  • Never stack overlays. A modal that needs a confirmation turns its footer into the confirmation.

The components it is made of

Nothing on this screen is drawn for it: every part is a component from the kit, used as documented.

  • Modal: A focused task on top of the page: a short form or a decision.
  • Drawer: A side panel for details or edits while the list stays in view.
  • Alert dialog: Confirms a destructive or costly action, and says what will happen.
  • Toast: A short, temporary confirmation of something that just happened.
  • Input: A single-line text field with label, hint and error, as one Field.
  • Select: One value from a list of up to about fifteen known options.
  • Switch: A setting that takes effect the moment it is flipped.
  • Status badge: The state of a campaign, partner or payment, in one word and one color.