Category · Widgets Difficulty Level · Intermediate Published on · August 18, 2025
Notification Toast
Modern notification toast system with multiple types, animations, and auto-dismiss functionality for user feedback.
#notification #toast #alert #feedback #animation #responsive
Responsive Design
Yes
Dark Mode Support
No
lines
990
Browser Compatibility
Chrome · Firefox · Safari · Edge
Live Preview
Interact with the component without leaving the page.
HTML
130
lines
CSS
524
lines
JavaScript
336
lines
<div class="toast-container">
<div class="toast-header">
<h1 class="toast-title">Notification Toast System</h1>
<p class="toast-subtitle">Interactive notification system with multiple types and animations</p>
</div>
<div class="toast-demo">
<div class="demo-controls">
<h2>Try Different Notifications</h2>
<div class="control-buttons">
<button class="demo-btn success" data-type="success">
<svg viewBox="0 0 24 24" fill="currentColor">
<path d="M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"/>
</svg>
Success
</button>
<button class="demo-btn error" data-type="error">
<svg viewBox="0 0 24 24" fill="currentColor">
<path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"/>
</svg>
Error
</button>
<button class="demo-btn warning" data-type="warning">
<svg viewBox="0 0 24 24" fill="currentColor">
<path d="M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z"/>
</svg>
Warning
</button>
<button class="demo-btn info" data-type="info">
<svg viewBox="0 0 24 24" fill="currentColor">
<path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z"/>
</svg>
Info
</button>
<button class="demo-btn loading" data-type="loading">
<svg viewBox="0 0 24 24" fill="currentColor">
<path d="M12 6v3l4-4-4-4v3c-4.42 0-8 3.58-8 8 0 1.57.46 3.03 1.24 4.26L6.7 14.8c-.45-.83-.7-1.79-.7-2.8 0-3.31 2.69-6 6-6z"/>
</svg>
Loading
</button>
</div>
<div class="demo-options">
<div class="option-group">
<label for="positionSelect">Position:</label>
<select id="positionSelect">
<option value="top-right">Top Right</option>
<option value="top-left">Top Left</option>
<option value="bottom-right">Bottom Right</option>
<option value="bottom-left">Bottom Left</option>
<option value="top-center">Top Center</option>
<option value="bottom-center">Bottom Center</option>
</select>
</div>
<div class="option-group">
<label for="durationSelect">Duration:</label>
<select id="durationSelect">
<option value="3000">3 seconds</option>
<option value="5000" selected>5 seconds</option>
<option value="8000">8 seconds</option>
<option value="0">No auto-dismiss</option>
</select>
</div>
<div class="option-group">
<label>
<input type="checkbox" id="soundEnabled" checked>
Enable Sound
</label>
</div>
<div class="option-group">
<label>
<input type="checkbox" id="animationEnabled" checked>
Enable Animation
</label>
</div>
</div>
<div class="bulk-actions">
<button class="action-btn" id="showMultiple">
<svg viewBox="0 0 24 24" fill="currentColor">
<path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"/>
</svg>
Show Multiple
</button>
<button class="action-btn" id="clearAll">
<svg viewBox="0 0 24 24" fill="currentColor">
<path d="M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z"/>
</svg>
Clear All
</button>
</div>
</div>
<div class="demo-preview">
<h3>Live Preview</h3>
<p>Click the buttons above to see notifications in action. Notifications will appear in the selected position with the configured settings.</p>
<div class="preview-stats">
<div class="stat-item">
<span class="stat-number" id="totalShown">0</span>
<span class="stat-label">Total Shown</span>
</div>
<div class="stat-item">
<span class="stat-number" id="currentActive">0</span>
<span class="stat-label">Currently Active</span>
</div>
<div class="stat-item">
<span class="stat-number" id="autoDismissed">0</span>
<span class="stat-label">Auto Dismissed</span>
</div>
</div>
</div>
</div>
<!-- Toast Container Areas -->
<div class="toast-area top-right" id="toast-top-right"></div>
<div class="toast-area top-left" id="toast-top-left"></div>
<div class="toast-area bottom-right" id="toast-bottom-right"></div>
<div class="toast-area bottom-left" id="toast-bottom-left"></div>
<div class="toast-area top-center" id="toast-top-center"></div>
<div class="toast-area bottom-center" id="toast-bottom-center"></div>
</div>
Browser Compatibility
Chrome
≥ 60
Firefox
≥ 55
Safari
≥ 10
Edge
≥ 15