|$ curl https://forge-ai.dev/api/markdown?path=docs/components/alerts
$cat docs/alerts-&-notifications.md
updated Recently·10 min read·published

Alerts & Notifications

CSSHTMLUIIntermediate

10+ alert and notification patterns — variants, toasts, banners, dismissible, and inline alerts with icons.

Alert Variants

Success, error, warning, and info alerts with matching icons and colors.

alert-variants
Live
untitled.html
HTML
1<div class="wrap">
2 <div class="alert success">
3 <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
4 <path d="M22 11.08V12a10 10 0 1 1-5.93-9.14"/>
5 <polyline points="22 4 12 14.01 9 11.01"/>
6 </svg>
7 <span>
8 Settings saved successfully.
9 </span>
10 </div>
11 <div class="alert error">
12 <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
13 <circle cx="12" cy="12" r="10"/>
14 <line x1="15" y1="9" x2="9" y2="15"/>
15 <line x1="9" y1="9" x2="15" y2="15"/>
16 </svg>
17 <span>
18 Failed to save. Please try again.
19 </span>
20 </div>
21 <div class="alert warning">
22 <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
23 <path d="M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"/>
24 <line x1="12" y1="9" x2="12" y2="13"/>
25 <line x1="12" y1="17" x2="12.01" y2="17"/>
26 </svg>
27 <span>
28 Your session will expire in 5 minutes.
29 </span>
30 </div>
31 <div class="alert info">
32 <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
33 <circle cx="12" cy="12" r="10"/>
34 <line x1="12" y1="16" x2="12" y2="12"/>
35 <line x1="12" y1="8" x2="12.01" y2="8"/>
36 </svg>
37 <span>
38 A new update is available.
39 </span>
40 </div>
41</div>
preview
Dismissible Alerts

Alerts with close button and optional undo action.

alert-dismiss
Live
untitled.html
HTML
1<div class="wrap">
2 <div class="alert success">
3 <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
4 <path d="M22 11.08V12a10 10 0 1 1-5.93-9.14"/>
5 <polyline points="22 4 12 14.01 9 11.01"/>
6 </svg>
7 <span class="flex-1">
8 Message sent successfully.
9 </span>
10 <button class="undo">
11 Undo
12 </button>
13 <button class="close">
14 &times;
15 </button>
16 </div>
17 <div class="alert warning">
18 <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
19 <path d="M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"/>
20 <line x1="12" y1="9" x2="12" y2="13"/>
21 <line x1="12" y1="17" x2="12.01" y2="17"/>
22 </svg>
23 <span class="flex-1">
24 Low disk space.
25 </span>
26 <button class="close">
27 &times;
28 </button>
29 </div>
30</div>
preview
Toast Notifications

Corner-positioned toast notifications with slide-in animation and auto-dismiss styling.

alerts-toast
Live
untitled.html
HTML
1<div class="container">
2 <div class="toast success">
3 <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
4 <path d="M22 11.08V12a10 10 0 1 1-5.93-9.14"/>
5 <polyline points="22 4 12 14.01 9 11.01"/>
6 </svg>
7 <div>
8 <strong>
9 Saved!
10 </strong>
11 <p>
12 Your changes have been saved.
13 </p>
14 </div>
15 </div>
16 <div class="toast error">
17 <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
18 <circle cx="12" cy="12" r="10"/>
19 <line x1="15" y1="9" x2="9" y2="15"/>
20 <line x1="9" y1="9" x2="15" y2="15"/>
21 </svg>
22 <div>
23 <strong>
24 Error
25 </strong>
26 <p>
27 Could not connect to server.
28 </p>
29 </div>
30 <span class="t-close">
31 &times;
32 </span>
33 </div>
34</div>
preview
Inline Alerts

Compact inline alerts for form fields and small UI areas.

alert-inline
Live
untitled.html
HTML
1<div class="wrap">
2 <div class="inline error">
3 <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
4 <circle cx="12" cy="12" r="10"/>
5 <line x1="12" y1="8" x2="12" y2="12"/>
6 <line x1="12" y1="16" x2="12.01" y2="16"/>
7 </svg>
8 Please enter a valid email address.
9 </div>
10 <div class="inline success">
11 <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
12 <path d="M22 11.08V12a10 10 0 1 1-5.93-9.14"/>
13 <polyline points="22 4 12 14.01 9 11.01"/>
14 </svg>
15 Username is available.
16 </div>
17 <div class="inline warning">
18 <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
19 <circle cx="12" cy="12" r="10"/>
20 <line x1="12" y1="8" x2="12" y2="12"/>
21 <line x1="12" y1="16" x2="12.01" y2="16"/>
22 </svg>
23 Password must be at least 8 characters.
24 </div>
25</div>
preview