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

Toast Notifications

CSSHTMLUIIntermediate🎯Free Tools

Toast notifications with success, error, warning, and info variants — auto-dismiss, stacking, positions, and progress indicators.

Toast Variants

Four semantic toast types with matching icons and accent colors for different notification contexts.

toast-variants
Live
untitled.html
HTML
1<div class="wrap">
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 class="content">
8 <strong>
9 Success
10 </strong>
11 <p>
12 Your changes have been saved successfully.
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 class="content">
23 <strong>
24 Error
25 </strong>
26 <p>
27 Failed to connect. Please try again.
28 </p>
29 </div>
30 </div>
31 <div class="toast warning">
32 <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
33 <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"/>
34 <line x1="12" y1="9" x2="12" y2="13"/>
35 <line x1="12" y1="17" x2="12.01" y2="17"/>
36 </svg>
37 <div class="content">
38 <strong>
39 Warning
40 </strong>
41 <p>
42 Your session will expire in 5 minutes.
43 </p>
44 </div>
45 </div>
46 <div class="toast info">
47 <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
48 <circle cx="12" cy="12" r="10"/>
49 <line x1="12" y1="16" x2="12" y2="12"/>
50 <line x1="12" y1="8" x2="12.01" y2="8"/>
51 </svg>
52 <div class="content">
53 <strong>
54 Info
55 </strong>
56 <p>
57 A new software update is available.
58 </p>
59 </div>
60 </div>
61</div>
preview

info

Use toasts for brief, non-blocking notifications. They should auto-dismiss after 3-5 seconds for success messages, but persist for errors until the user dismisses them.
Dismissible

Toasts with a close button for manual dismissal — essential for error messages users need to read.

toast-dismiss
Live
untitled.html
HTML
1<div class="wrap">
2 <div class="toast success dismissible">
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 class="content">
8 <strong>
9 File uploaded
10 </strong>
11 <p>
12 report-2024.pdf has been uploaded.
13 </p>
14 </div>
15 <button class="close">
16 &times;
17 </button>
18 </div>
19 <div class="toast error dismissible">
20 <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
21 <circle cx="12" cy="12" r="10"/>
22 <line x1="15" y1="9" x2="9" y2="15"/>
23 <line x1="9" y1="9" x2="15" y2="15"/>
24 </svg>
25 <div class="content">
26 <strong>
27 Upload failed
28 </strong>
29 <p>
30 File exceeds 10MB limit.
31 </p>
32 </div>
33 <button class="close">
34 &times;
35 </button>
36 </div>
37</div>
preview
With Action Buttons

Toasts with action buttons for undo, retry, or navigation — gives users a clear next step.

toast-action
Live
untitled.html
HTML
1<div class="wrap">
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 class="content">
8 <strong>
9 Message sent
10 </strong>
11 <p>
12 Your email has been delivered.
13 </p>
14 </div>
15 <button class="toast-btn">
16 Undo
17 </button>
18 </div>
19 <div class="toast error">
20 <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
21 <circle cx="12" cy="12" r="10"/>
22 <line x1="15" y1="9" x2="9" y2="15"/>
23 <line x1="9" y1="9" x2="15" y2="15"/>
24 </svg>
25 <div class="content">
26 <strong>
27 Sync failed
28 </strong>
29 <p>
30 Could not sync your data.
31 </p>
32 </div>
33 <button class="toast-btn">
34 Retry
35 </button>
36 </div>
37</div>
preview

best practice

Action buttons in toasts should use outline or ghost styling to avoid competing visually with the main content area. Keep the button text short — "Undo", "Retry", "View" — not full sentences.
Positions

Toast placement in different corners and edges — choose the position that least disrupts the user flow.

toast-positions
Live
untitled.html
HTML
1<div class="grid">
2 <div class="pos top-left">
3 <div class="toast info mini">
4 Top Left
5 </div>
6 </div>
7 <div class="pos top-right">
8 <div class="toast info mini">
9 Top Right
10 </div>
11 </div>
12 <div class="pos bottom-left">
13 <div class="toast info mini">
14 Bottom Left
15 </div>
16 </div>
17 <div class="pos bottom-right">
18 <div class="toast info mini">
19 Bottom Right
20 </div>
21 </div>
22 <div class="pos top-center">
23 <div class="toast info mini">
24 Top Center
25 </div>
26 </div>
27</div>
preview

warning

Position toasts away from primary navigation areas. Bottom-right is the most common default. Avoid top-center for long messages as it can overlap with the browser toolbar on mobile.
Stacking

Multiple toasts stacking vertically with spacing — newer toasts push older ones up.

toast-stack
Live
untitled.html
HTML
1<div class="stack-area">
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 class="content">
8 <strong>
9 Saved
10 </strong>
11 <p>
12 Profile updated.
13 </p>
14 </div>
15 </div>
16 <div class="toast info">
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="12" y1="16" x2="12" y2="12"/>
20 <line x1="12" y1="8" x2="12.01" y2="8"/>
21 </svg>
22 <div class="content">
23 <strong>
24 New message
25 </strong>
26 <p>
27 You have 3 unread messages.
28 </p>
29 </div>
30 </div>
31 <div class="toast warning">
32 <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
33 <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"/>
34 <line x1="12" y1="9" x2="12" y2="13"/>
35 <line x1="12" y1="17" x2="12.01" y2="17"/>
36 </svg>
37 <div class="content">
38 <strong>
39 Storage low
40 </strong>
41 <p>
42 Only 2GB remaining.
43 </p>
44 </div>
45 </div>
46</div>
preview
With Progress Bar

Toasts with a progress bar showing remaining time before auto-dismiss — gives users a visual countdown.

toast-progress
Live
untitled.html
HTML
1<div class="wrap">
2 <div class="toast success with-progress">
3 <div class="progress-track">
4 <div class="progress-fill" style="width:80%">
5 </div>
6 </div>
7 <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
8 <path d="M22 11.08V12a10 10 0 1 1-5.93-9.14"/>
9 <polyline points="22 4 12 14.01 9 11.01"/>
10 </svg>
11 <div class="content">
12 <strong>
13 Processing
14 </strong>
15 <p>
16 Your request is being processed...
17 </p>
18 </div>
19 </div>
20 <div class="toast error with-progress">
21 <div class="progress-track">
22 <div class="progress-fill err" style="width:45%">
23 </div>
24 </div>
25 <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
26 <circle cx="12" cy="12" r="10"/>
27 <line x1="15" y1="9" x2="9" y2="15"/>
28 <line x1="9" y1="9" x2="15" y2="15"/>
29 </svg>
30 <div class="content">
31 <strong>
32 Error
33 </strong>
34 <p>
35 This toast persists until dismissed.
36 </p>
37 </div>
38 </div>
39</div>
preview
🔥

pro tip

A shrinking progress bar at the top of the toast visually communicates how long it will stay visible. Animate the width from 100% to 0% over the auto-dismiss duration. For persistent toasts (errors), omit the progress bar entirely.
Rich Toast

Toasts with avatars, images, and complex layouts for richer notification content.

toast-rich
Live
untitled.html
HTML
1<div class="wrap">
2 <div class="toast rich">
3 <div class="t-avatar" style="background:#3B82F6">
4 JD
5 </div>
6 <div class="content">
7 <strong>
8 Jane commented on your post
9 </strong>
10 <p>
11 &quot;Great article! The section on caching was really helpful.&quot;
12 </p>
13 </div>
14 </div>
15 <div class="toast rich">
16 <div class="t-avatar" style="background:#A855F7">
17 AB
18 </div>
19 <div class="content">
20 <strong>
21 Alex shared a file
22 </strong>
23 <p>
24 design-system-v2.fig
25 </p>
26 </div>
27 <button class="toast-btn">
28 View
29 </button>
30 </div>
31</div>
preview
Minimal Style

Clean, minimal toasts with just an icon, text, and close button — no heavy backgrounds or borders.

toast-minimal
Live
untitled.html
HTML
1<div class="wrap">
2 <div class="toast mini success">
3 <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5">
4 <polyline points="20 6 9 17 4 12"/>
5 </svg>
6 <span>
7 Changes saved
8 </span>
9 <button class="close">
10 &times;
11 </button>
12 </div>
13 <div class="toast mini error">
14 <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5">
15 <line x1="18" y1="6" x2="6" y2="18"/>
16 <line x1="6" y1="6" x2="18" y2="18"/>
17 </svg>
18 <span>
19 Connection lost
20 </span>
21 <button class="close">
22 &times;
23 </button>
24 </div>
25 <div class="toast mini info">
26 <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5">
27 <circle cx="12" cy="12" r="10"/>
28 <line x1="12" y1="16" x2="12" y2="12"/>
29 <line x1="12" y1="8" x2="12.01" y2="8"/>
30 </svg>
31 <span>
32 Tip: Press Cmd+K to search
33 </span>
34 <button class="close">
35 &times;
36 </button>
37 </div>
38</div>
preview
📝

note

Minimal toasts work well in developer tools and power-user interfaces where visual noise should be low. For consumer-facing apps, the richer variants with titles and descriptions are usually more appropriate.