Toast components provide brief, temporary notifications that appear and disappear automatically. They’re designed for short, transient feedback like success messages, errors, or confirmations.
Non-modal notifications that don’t interrupt the user’s flow
Multiple variants : info, success, warning, and error
Configurable duration with auto-dismiss timer (or sticky)
Pause on hover to give users time to read longer messages
Placement options in any corner of the screen
Stacking support for multiple notifications
Accessible with appropriate ARIA attributes and keyboard support
<!-- In your HTML page -->
import { showToast, createToastHelpers } from ' @aetherui-kit/core/toast ' ;
message: ' Operation completed successfully! ' ,
placement: ' bottom-right ' ,
// Or with convenience helpers
const toast = createToastHelpers ();
toast . success ( ' Operation completed successfully! ' );
toast . error ( ' Something went wrong ' );
import { useEffect } from ' react ' ;
import { showToast, createToastHelpers } from ' @aetherui-kit/core/toast ' ;
const toast = createToastHelpers ();
const handleSuccess = () => {
toast . success ( ' Operation completed successfully! ' ) ;
const handleError = () => {
toast . error ( ' Something went wrong ' , {
duration: 8000 , // 8 seconds
< button onClick = { handleSuccess } > Success </ button >
< button onClick = { handleError } > Error </ button >
< button @click = " showSuccessToast " > Success </ button >
< button @click = " showErrorToast " > Error </ button >
import { showToast, createToastHelpers } from ' @aetherui-kit/core/toast ' ;
const toast = createToastHelpers ();
const showSuccessToast = () => {
toast . success ( ' Operation completed successfully! ' ) ;
const showErrorToast = () => {
toast . error ( ' Something went wrong ' , {
Property
Type
Default
Description
message
string
''
Main text content (can also use default slot)
variant
'info' | 'success' | 'warning' | 'error'
'info'
Visual styling preset
open
boolean
true
Controls visibility
duration
number
5000
Auto-dismiss time in ms (0 = sticky)
placement
'top-right' | 'bottom-right' | 'top-left' | 'bottom-left'
'bottom-right'
Screen corner position
pauseOnHover
boolean
true
Pause countdown when hovered
Event
Detail
Description
ae-close
{ source: 'timeout' | 'closeButton' | 'keyboard' }
Fired when toast is dismissed
ae-click
{ originalEvent: MouseEvent }
Fired when toast is clicked
Name
Description
(default)
Main content of the toast
icon
Custom icon (replaces default variant icon)
Part
Description
toast
Main container
icon
Status icon
content
Message text wrapper
close
Close button
progress
Progress bar showing time remaining
Property
Description
--ae-toast-bg-info
Info variant background color
--ae-toast-bg-success
Success variant background color
--ae-toast-bg-warning
Warning variant background color
--ae-toast-bg-error
Error variant background color
--ae-toast-fg-*
Corresponding text colors
--ae-toast-radius
Corner rounding
--ae-toast-shadow
Elevation shadow
--ae-toast-progress-height
Progress bar thickness
--ae-toast-z-index
Stacking layer
The toast component provides two helper functions for creating toasts programmatically:
message: ' Your message here ' ,
variant: ' success ' , // 'info', 'success', 'warning', 'error'
duration: 5000 , // milliseconds (0 = sticky)
placement: ' bottom-right ' ,
const toast = createToastHelpers ();
toast . info ( ' Information message ' );
toast . success ( ' Success message ' );
toast . warning ( ' Warning message ' );
toast . error ( ' Error message ' );
// With additional options
toast . success ( ' Custom success ' , {
Show Info Toast Show Success Toast Show Warning Toast Show Error Toast
import { createToastHelpers } from ' @aetherui-kit/core/toast ' ;
const toast = createToastHelpers ();
toast . info ( ' This is an information message ' );
toast . success ( ' Operation completed successfully! ' );
toast . warning ( ' This action cannot be undone ' );
toast . error ( ' Something went wrong ' );
import { showToast } from ' @aetherui-kit/core/toast ' ;
// Quick toast (2 seconds)
message: ' Quick notification ' ,
// Sticky toast (no auto-dismiss)
message: ' This will stay until closed ' ,
import { showToast } from ' @aetherui-kit/core/toast ' ;
message: ' Top right notification ' ,
message: ' Bottom left notification ' ,
// Creating a custom toast element
const toast = document . createElement ( ' ae-toast ' );
// Adding custom HTML content
const content = document . createElement ( ' div ' );
<div style="display: flex; align-items: center; gap: 0.5rem;">
<img src="/avatar.jpg" style="width: 24px; height: 24px; border-radius: 50%;">
<div style="font-weight: bold;">New Message</div>
<div style="font-size: 0.875rem;">You have a new message from User123</div>
toast . appendChild ( content );
document . body . appendChild ( toast );
The Toast component implements several accessibility features:
Uses appropriate ARIA roles: role="status" for info/success and role="alert" for warning/error
Sets aria-live="polite" or aria-live="assertive" based on importance
Makes toast focusable with keyboard navigation (ESC to dismiss)
Does not steal focus when appearing
Supports reduced-motion preferences
Keep messages brief and to the point
Use appropriate variants based on the importance of the message
Set appropriate durations based on message length (longer messages need more time)
Don’t overuse toasts – they’re best for transient feedback, not critical information
Place consistently – don’t mix placements unnecessarily
Consider mobile users when designing toast content
/* Customize toast appearance */
font-family : ' Inter ' , sans-serif ;
/* Customize success variant */
ae-toast [ variant = " success " ]::part(toast ) {
background-color : # d1fae5 ;
/* Add subtle outline for high-contrast users */
@media ( forced-colors: active ) {
outline : 2 px solid CanvasText;
/* Custom entrance animation */
transform : translateY ( -100 % );
transform : translateY ( 0 );
animation : slide-in 0.3 s ease-out ;