Feedback
Layout
Toaster
The container that shows the notifications toast() creates. Mount it once, anywhere in your app.
Install
import { Toaster } from 'vael-ui'Playground
bottom-right
import { toast, Toaster } from 'vael-ui'
<Toaster position="bottom-right" :max-visible="4" :gap="10" />
// anywhere in your app
toast('Saved changes')
toast.success('Upload complete')
// pinned: its own section, never covered by newer toasts
// id: calling again updates this toast instead of adding a second one
toast.warning('Verify your email', { id: 'verify-email', pinned: true, duration: Infinity })
toast.dismiss('verify-email')Motion New
Toaster's motion: values or hooks for its parts (ToasterPart), its states (loading, success, error, warning, info), how its items come and go (stagger, leaving, appear). false turns it off.
<Toaster
:motion="{ initial: { toast: { opacity: 0, y: 8 } }, stagger: 0.04 }"
/>| Name | Type | Description |
|---|---|---|
initialexit | roottoasticoncontenttitledescriptionactionclose | Sets where each part comes in from and leaves to: any CSS property, plus x, y and blur. A plain number is px, or degrees for rotate. |
states | loadingsuccesserrorwarninginfo | Sets values per part that hold while a state is on. An array is a set of keyframes that plays once as the state turns on, such as a shake on invalid. |
enterleave | (parts, context) => animation | Animates the parts with GSAP, motion or element.animate(). Return the animation and the component waits for it, and stops it if interrupted. |
staggerleavingappear | number | 'pop' | 'hold' | boolean | Items coming in together start stagger seconds apart. A leaving item lifts out so the rest close the gap ('pop'), or keeps its space until it's gone ('hold'). appear: true also brings in the items already there when it mounts. |
springdurationeasing | { damping, response } | number | string | Times all of it: a spring, or a duration in ms with an easing. Never both. |
false | boolean | Turns its motion off, for an animation of your own on its exposed elements. |
Accessibility
| Key | Action |
|---|---|
| EnterSpace | Runs the focused toast’s action or dismiss button. |
- Toasts render in a
<section aria-live="polite">named “Notifications”, so screen readers announce them without moving focus. Error toasts are announced assertively. Passaria-labelto rename the section when a page has more than one Toaster. - Hovering or focusing the stack expands it and pauses every timer; timers also pause while the tab is hidden. Toasts close after 4000 ms by default. Toasts with an action stay until someone closes them, so a keyboard user can reach the button, and loading toasts stay until they settle.
- The dismiss button is named “Dismiss” and the status icon is
aria-hidden. A custom default slot replaces this markup, so label your own buttons. - Dismissing a toast from the keyboard moves focus to a neighboring toast, or back to where focus came from.