Toast
A channel-based notification outlet with complete severity surfaces, logical positioning, accessible announcements and deterministic lifetimes.
GET STARTED
Import and providers
Register the Message API once, then place a Toast outlet where that channel should render.
Basic notification
The service owns messages; the outlet owns presentation, placement, timers and dismissal.
Complete severity surfaces
Severity colors the background, border, content, icon, close control and progress treatment—not only one edge.
Logical positions
Start and end follow document direction. Middle positions use the same accessible outlet and cleanup behavior.
Lifetime, progress and pause
Finite messages share one timer with the progress bar. Hover and focus pause both. Use duration: null for persistent work.
Show progress
Enable showProgress to expose the remaining lifetime visually. The indicator pauses and resumes with the message timer.
Icons
Automatic Neural Icons follow severity. Disable them with icon=false or replace all with iconClass.
Independent channels
Route notifications to independent outlets such as global, billing or uploads without coupling feature code to presentation.
Unstyled and class ownership
Unstyled mode retains channels, timers, live regions, swipe and structural hooks while every visual class moves to the consumer.
TOAST
Accessibility
Stable live regions announce messages without moving keyboard focus or duplicating screen-reader output.
Live regions
Regular notifications use one polite status region. Warning and error messages use an assertive alert region. Visible cards themselves do not duplicate these roles.
Interaction and focus
Toast never steals focus. Dismiss buttons have localized accessible labels, keyboard focus rings and pause the active timer while focused.
Motion and touch
Swipe dismissal preserves vertical scrolling. Reduced-motion preferences collapse enter, leave and reset durations without removing state transitions.
TOAST
API
Outlet configuration stays separate from the serializable message contract.
Toast inputs
| Name | Type | Default | Purpose |
|---|---|---|---|
| channel | string | 'global' | Selects the Message API stream. |
| position | NeuralToastPosition | 'top-end' | Logical viewport placement. |
| icon | boolean | true | Shows the decorative severity icon. |
| iconClass | string | '' | Overrides the automatic severity icon. |
| showProgress | boolean | false | Shows finite lifetime progress. |
| pauseOnInteraction | boolean | true | Pauses on hover and focus. |
| swipeToDismiss | boolean | true | Enables pointer swipe dismissal. |
| swipeThreshold | number | 72 | Dismissal distance in pixels. |
| animated | boolean | true | Enables enter and leave motion. |
| unstyled | boolean | false | Removes NeuralNg visual classes. |
| toastClass | string | '' | Adds classes to the outlet. |
| messageClass | string | '' | Adds classes to every message. |
Message API
notify() returns a reference with id, closed and closeReason Signals plus dismiss(). The service also exposes dismiss(id) and clear(channel?). Message payloads accept severity, title, message, channel, duration, dismissible and data.
Position union
top-starttop-centertop-endmiddle-startmiddle-centermiddle-endbottom-startbottom-centerbottom-endTOAST
Design tokens
Severity surfaces derive from semantic color tokens while preserving theme and consumer overrides.
Toast tokens
--neural-toast-widthToast stack inline size.
--neural-toast-insetToast stack logical inset from its containing edge.
--neural-toast-stack-gapSpacing between stack items.
--neural-toast-message-paddingMessage internal spacing.
--neural-toast-message-backgroundMessage background surface.
--neural-toast-message-border-colorMessage border color.
--neural-toast-message-radiusMessage corner radius.
--neural-toast-message-shadowMessage box shadow.
--neural-toast-primary-colorPrimary severity foreground color.
--neural-toast-secondary-colorSecondary severity foreground color.
--neural-toast-info-colorInfo severity foreground color.
--neural-toast-success-colorSuccess severity foreground color.
--neural-toast-warning-colorWarning severity foreground color.
--neural-toast-error-colorError severity foreground color.
--neural-toast-progress-heightProgress block size.
--neural-toast-enter-durationToast stack enter animation duration.
--neural-toast-leave-durationToast stack leave animation duration.