Components

Dialogs & Alerts

Native dialog patterns — sizes, scrollable, confirmation, and stacked — plus notification banners, inline labels, and toast messages.

Dialogs

Structured Dialog

Use dialog-header, dialog-body, and dialog-footer for a consistent header/body/footer layout.

Edit Profile

<dialog id="my-dialog" aria-labelledby="dialog-title">
  <div class="dialog-header">
    <h3 id="dialog-title">Edit Profile</h3>
    <button class="dialog-close" aria-label="Close">&times;</button>
  </div>
  <div class="dialog-body">
    <form class="form">...</form>
  </div>
  <div class="dialog-footer">
    <button class="btn btn-secondary">Cancel</button>
    <button class="btn btn-primary">Save</button>
  </div>
</dialog>

Sizes

Dialog Sizes

Small Dialog

Max-width 24rem.

Default Dialog

Default browser width for <dialog>.

Large Dialog

Max-width 48rem.

<dialog class="dialog-sm">...</dialog>  <!-- 24rem -->
<dialog>...</dialog>                     <!-- Default -->
<dialog class="dialog-lg">...</dialog>   <!-- 48rem -->
<dialog class="dialog-full">...</dialog> <!-- Viewport -->

Pattern

Confirmation Dialog

Delete this item?

This action cannot be undone.

<dialog class="dialog-confirm" aria-labelledby="confirm-title">
  <div class="dialog-body">
    <h3 id="confirm-title">Delete this item?</h3>
    <p class="text-secondary">This cannot be undone.</p>
  </div>
  <div class="dialog-footer">
    <button class="btn btn-secondary">Cancel</button>
    <button class="btn btn-red">Delete</button>
  </div>
</dialog>

Pattern

Scrollable Dialog

Terms of Service

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.

Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.

Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium.

Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit.

At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum.

Similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga.

Advanced

Stacked Dialogs

Layer 1 — Main Dialog

Base dialog. Click below to open a nested dialog on top.

Layer 2 — Nested

This sits above the first dialog.

<dialog class="dialog-layer-1">...</dialog>
<dialog class="dialog-layer-2 dialog-sm">...</dialog>
<dialog class="dialog-layer-3">...</dialog>

Alerts

Standard Alerts

Default — A neutral notification message.
Information — Something you should know about.
Success — Operation completed successfully.
Warning — Proceed with caution.
Error — Something went wrong.
Neutral — A dark notification style.
<div class="alert alert-blue" role="status">
  <span class="alert-content">Info message here.</span>
</div>
<div class="alert alert-green" role="status">
  <span class="alert-content">Success!</span>
</div>
<div class="alert alert-red" role="alert">
  <span class="alert-content">Error occurred.</span>
</div>

Outline

Outlined Alerts

Tinted background with a full border using alert-outline.

Default outlined alert.
Outlined info alert with tinted background.
Outlined success alert.
Outlined warning alert.
Outlined error alert.
<div class="alert alert-blue alert-outline">
  <span class="alert-content">Outlined info alert.</span>
</div>

Ghost

Ghost Alerts

Transparent background with border only using alert-ghost.

Ghost info alert — transparent background.
Ghost success alert.
Ghost error alert.

Interactive

Dismissible Alerts

Add an alert-dismiss button to make alerts closeable.

<div class="alert alert-blue" role="alert">
  <span class="alert-content">Dismissible alert.</span>
  <button class="btn btn-ghost btn-white btn-icon btn-xs" aria-label="Dismiss">&times;</button>
</div>

Labels

Inline Labels & Status

Default Blue Red Green Yellow Black White

Outlined Labels

Outline Blue Red Green
<span class="label label-blue">Blue</span>
<span class="label label-outline">Outline</span>
<span class="label label-outline label-red">Red Outline</span>

Badges

Badges

1 5 99+ 3 ! 0 7
sm sm sm
<span class="badge badge-blue">5</span>
<span class="badge badge-red">99+</span>
<span class="badge badge-small badge-green">sm</span>

Toast

Toast Messages

Fixed-position toast notifications using tools-message (alias: message). Hidden by default — toggle display with JavaScript.

<div class="message message-green" role="status" aria-live="polite">
  <span class="alert-content"><strong>Saved!</strong> Changes applied.</span>
  <button class="btn btn-ghost btn-white btn-icon btn-xs" aria-label="Dismiss">&times;</button>
</div>

<!-- For errors, use role="alert" and aria-live="assertive" -->
<div class="message message-red" role="alert" aria-live="assertive">
  <span class="alert-content">Error occurred.</span>
  <button class="btn btn-ghost btn-white btn-icon btn-xs" aria-label="Dismiss">&times;</button>
</div>

Accessibility

  • Use role="status" and aria-live="polite" for informational toasts — screen readers announce them after finishing the current task.
  • Use role="alert" and aria-live="assertive" for errors — screen readers interrupt immediately.
  • Always include a dismiss button with aria-label="Dismiss".
  • Toasts should auto-dismiss after a reasonable delay (5–10s), but not for error messages that require user action.
messageBase toast (fixed top-right)
message-blueBlue toast
message-redRed toast
message-greenGreen toast
message-yellowYellow toast
message-blackBlack toast

Reference

Alert Class Reference

All alert classes use the tools-alert-* prefix with shorter alert-* aliases.

tools-alert / alertBase alert
tools-alert-blue / alert-blueBlue/info
tools-alert-red / alert-redRed/error
tools-alert-green / alert-greenGreen/success
tools-alert-yellow / alert-yellowYellow/warning
tools-alert-black / alert-blackBlack/neutral
tools-alert-outline / alert-outlineOutlined variant
tools-alert-ghost / alert-ghostGhost variant
tools-alert-icon / alert-iconIcon container
tools-alert-content / alert-contentContent wrapper
tools-alert-dismiss / alert-dismissDismiss button

Next

Next Steps

Explore utility classes for spacing, display, and layout helpers, or learn about built-in accessibility features.