Overlays
Toaster <pm-toaster>
Where toasts appear and how many stack. Optional: toast() works without it.
Overview
Optional: toast() creates a region on demand; add <pm-toaster> once to choose where toasts appear and how many stack. Any element with data-toast shows a toast when clicked (no JS needed): data-toast="Saved" or data-toast='{"title":"Saved","tone":"success"}'. In JS use toast(), toast.success(), toast.error(), toast.promise() and toast.dismiss() from @prismora/elements/toast. On phones toasts are centred and full width (top or bottom, following position) unless keep-position is set.
Attributes
| Attribute | Type | Default | Description |
|---|---|---|---|
label | string | — | Accessible name of the region (default "Notifications"). |
position | 'top-start' | 'top-center' | 'top-end' | 'bottom-start' | 'bottom-center' | 'bottom-end' | — | Where toasts stack (default bottom-end). |
max | number | — | Most toasts shown at once; older ones leave first (default 4). |
keep-positionprop: keepPosition | boolean | — | Keep position on phones instead of centring. |
Also accepts the contextual attributes tone, surface, radius, density, motion, elevation. They are inherited from ancestors' data-* attributes.
Methods
show()