Toast Stack
Install the component, then paste your configured usage. Your settings are included in the code below.
npx arclen-ui add toast-stack --settings eyJ2YXJpYW50Ijoic3RhbmRhcmQiLCJ0aXRsZSI6IkNoYW5nZXMgc2F2ZWQiLCJkZXNjcmlwdGlvbiI6IllvdXIgd29ya3NwYWNlIGlzIHVwIHRvIGRhdGUuIiwibWVzc2FnZXMiOltdLCJ0eXBlIjoiZGVmYXVsdCIsImFjdGlvbkxhYmVsIjoiVW5kbyIsInNob3dBY3Rpb24iOnRydWUsInNob3dDbG9zZSI6dHJ1ZSwic2hvd0ljb24iOnRydWUsInJlZ2lvbkxhYmVsIjoiTm90aWZpY2F0aW9ucyIsImxvYWRpbmdMYWJlbCI6IlNhdmluZyBjaGFuZ2Vz4oCmIiwic3VjY2Vzc0xhYmVsIjoiQ2hhbmdlcyBzYXZlZCIsImVycm9yTGFiZWwiOiJDb3VsZCBub3Qgc2F2ZSBjaGFuZ2VzIiwicG9zaXRpb24iOiJib3R0b20tcmlnaHQiLCJwbGFjZW1lbnQiOiJ2aWV3cG9ydCIsIndpZHRoIjo0MjAsImluc2V0IjoyNCwiY29tcGFjdEluc2V0IjoxNiwiY29tcGFjdEF0Ijo2MDAsIm1heFZpc2libGUiOjMsImdhcCI6MTQsImRlcHRoT2Zmc2V0IjoxNCwiZGVwdGhTY2FsZSI6MC4wNSwiZXhwYW5kZWQiOmZhbHNlLCJwYWRkaW5nIjoxNiwidGhlbWUiOiJkYXJrIiwicGFsZXR0ZSI6ImxpYnJhcnkiLCJzdXJmYWNlQ29sb3IiOiIjMWMxYzFjIiwidGV4dENvbG9yIjoiI2ZmZmZmZiIsImRlc2NyaXB0aW9uQ29sb3IiOiIjY2NjY2NjIiwiYm9yZGVyQ29sb3IiOiIjMjYyNjI2IiwiYWN0aW9uQ29sb3IiOiIjZmZmZmZmIiwiYWN0aW9uVGV4dENvbG9yIjoiIzBkMGQwZCIsInN1Y2Nlc3NDb2xvciI6IiMwMDhhMmUiLCJpbmZvQ29sb3IiOiIjMDk3M2RjIiwid2FybmluZ0NvbG9yIjoiI2E4NTIwMCIsImVycm9yQ29sb3IiOiIjYzcwMDAwIiwicmFkaXVzIjoxOCwiYm9yZGVyV2lkdGgiOjEsInNoYWRvdyI6InNvZnQiLCJmb250U2l6ZSI6MTUsInRpdGxlV2VpZ2h0Ijo2MDAsImxpbmVIZWlnaHQiOjEuNCwiZGVzY3JpcHRpb25MaW5lSGVpZ2h0IjoxLjQsInRleHRHYXAiOjIsImljb25TaXplIjoxNiwiZHVyYXRpb24iOjQwMDAsInRyYW5zaXRpb25EdXJhdGlvbiI6NDAwLCJzaGFkb3dEdXJhdGlvbiI6MjAwLCJleGl0UmVtb3ZhbERlbGF5IjoyMDAsImVhc2luZyI6ImVhc2UiLCJsb2FkZXJEdXJhdGlvbiI6MTIwMCwiYW5pbWF0ZSI6dHJ1ZSwicGF1c2VPbkhvdmVyIjp0cnVlLCJleHBhbmRPbkhvdmVyIjp0cnVlLCJzd2lwZVRvRGlzbWlzcyI6dHJ1ZSwic3dpcGVUaHJlc2hvbGQiOjQ4LCJzd2lwZVZlbG9jaXR5IjowLjMsInByZXNlbnRhdGlvbiI6InRvYXN0IiwiYWN0aW9uSGVpZ2h0IjozNiwiYWN0aW9uUmFkaXVzIjoxMCwiZ3JhZGllbnRNb2RlIjoic3RhdHVzIiwiZ3JhZGllbnRTaGFwZSI6InNwb3RsaWdodCIsImdyYWRpZW50Q29sb3IiOiIjOTNjNWZkIiwiZ3JhZGllbnRTdHJlbmd0aCI6MTcsImdyYWRpZW50WCI6OTQsImdyYWRpZW50WSI6NzAsImdyYWRpZW50U3ByZWFkIjo3Mn0import { ToastStack } from "@/components/toast-stack";
export default function Example() {
return <ToastStack {...{
"variant": "standard",
"title": "Changes saved",
"description": "Your workspace is up to date.",
"messages": [],
"type": "default",
"actionLabel": "Undo",
"showAction": true,
"showClose": true,
"showIcon": true,
"regionLabel": "Notifications",
"loadingLabel": "Saving changes…",
"successLabel": "Changes saved",
"errorLabel": "Could not save changes",
"position": "bottom-right",
"placement": "viewport",
"width": 420,
"inset": 24,
"compactInset": 16,
"compactAt": 600,
"maxVisible": 3,
"gap": 14,
"depthOffset": 14,
"depthScale": 0.05,
"expanded": false,
"padding": 16,
"theme": "dark",
"palette": "library",
"surfaceColor": "#1c1c1c",
"textColor": "#ffffff",
"descriptionColor": "#cccccc",
"borderColor": "#262626",
"actionColor": "#ffffff",
"actionTextColor": "#0d0d0d",
"successColor": "#008a2e",
"infoColor": "#0973dc",
"warningColor": "#a85200",
"errorColor": "#c70000",
"radius": 18,
"borderWidth": 1,
"shadow": "soft",
"fontSize": 15,
"titleWeight": 600,
"lineHeight": 1.4,
"descriptionLineHeight": 1.4,
"textGap": 2,
"iconSize": 16,
"duration": 4000,
"transitionDuration": 400,
"shadowDuration": 200,
"exitRemovalDelay": 200,
"easing": "ease",
"loaderDuration": 1200,
"animate": true,
"pauseOnHover": true,
"expandOnHover": true,
"swipeToDismiss": true,
"swipeThreshold": 48,
"swipeVelocity": 0.3,
"presentation": "toast",
"actionHeight": 36,
"actionRadius": 10,
"gradientMode": "status",
"gradientShape": "spotlight",
"gradientColor": "#93c5fd",
"gradientStrength": 17,
"gradientX": 94,
"gradientY": 70,
"gradientSpread": 72
}} />;
}| Property | Type | Default |
|---|---|---|
variantCard style Options: standard, headless | select | "standard" |
titleTitle Up to 240 characters | text | "Changes saved" |
descriptionDescription Up to 1000 characters | text | "Your workspace is up to date." |
messagesAdditional messages Minimum 0 itemsMaximum 20 itemsUp to 240 characters per item | string-list | [] |
typeNotification type Options: default, success, info, warning, error, loading, custom | select | "default" |
actionLabelAction label Up to 60 characters | text | "Undo" |
showActionShow action | boolean | true |
showCloseShow close button | boolean | true |
showIconShow status icon | boolean | true |
regionLabelRegion label Up to 100 characters | text | "Notifications" |
loadingLabelLoading text Up to 240 characters | text | "Saving changes…" |
successLabelResolved text Up to 240 characters | text | "Changes saved" |
errorLabelFailure text Up to 240 characters | text | "Could not save changes" |
positionPosition Options: top-left, top-center, top-right, bottom-left, bottom-center, bottom-right | select | "bottom-right" |
placementPositioning context Options: viewport, container | select | "viewport" |
widthCard width 240–960Step 1 | number | 420 |
insetWide inset 0–96Step 1 | number | 24 |
compactInsetCompact inset 0–48Step 1 | number | 16 |
compactAtCompact threshold 320–900Step 1 | number | 600 |
maxVisibleVisible stack depth 1–8Step 1 | number | 3 |
gapExpanded gap 4–40Step 1 | number | 14 |
depthOffsetCollapsed offset 0–32Step 1 | number | 14 |
depthScaleScale loss per layer 0–0.1Step 0.01 | number | 0.05 |
expandedAlways expand stack | boolean | false |
paddingCard padding 8–32Step 1 | number | 16 |
themeTheme Options: light, dark, auto | select | "auto" |
palettePalette Options: monochrome, semantic, custom, library | select | "library" |
surfaceColorSurface | color | "#1c1c1c" |
textColorText | color | "#ffffff" |
descriptionColorSecondary text | color | "#cccccc" |
borderColorBorder | color | "#262626" |
actionColorAction surface | color | "#ffffff" |
actionTextColorAction text | color | "#0d0d0d" |
successColorSuccess accent | color | "#008a2e" |
infoColorInfo accent | color | "#0973dc" |
warningColorWarning accent | color | "#a85200" |
errorColorError accent | color | "#c70000" |
radiusCorner radius 0–32Step 1 | number | 18 |
borderWidthBorder width 0–3Step 1 | number | 1 |
shadowShadow Options: none, soft, strong | select | "soft" |
fontSizeText size 11–32Step 1 | number | 15 |
titleWeightTitle weight 400–700Step 100 | number | 600 |
lineHeightTitle line height 1.2–1.8Step 0.05 | number | 1.4 |
descriptionLineHeightDescription line height 1.2–1.8Step 0.05 | number | 1.4 |
textGapText gap 0–12Step 1 | number | 2 |
iconSizeStatus icon slot 12–28Step 1 | number | 16 |
durationLifetime (ms; 0 persists) 0–30000Step 100 | number | 4000 |
transitionDurationTravel duration (ms) 0–1000Step 10 | number | 400 |
shadowDurationFocus shadow duration (ms) 0–500Step 10 | number | 200 |
exitRemovalDelayExit removal delay (ms) 0–1000Step 10 | number | 200 |
easingTravel easing Options: ease, ease-out, linear | select | "ease" |
loaderDurationLoader cycle (ms) 600–2400Step 100 | number | 1200 |
animateAnimate | boolean | true |
pauseOnHoverPause on hover | boolean | true |
expandOnHoverExpand on hover | boolean | true |
swipeToDismissSwipe to dismiss | boolean | true |
swipeThresholdSwipe commit distance 24–120Step 1 | number | 48 |
swipeVelocitySwipe commit velocity (px/ms) 0.1–1Step 0.05 | number | 0.3 |
presentationPresentation Options: toast, compact, banner | select | "toast" |
actionHeightAction height 24–72Step 1 | number | 36 |
actionRadiusAction radius 0–32Step 1 | number | 10 |
gradientModeGradient mode Options: off, neutral, status, custom | select | "status" |
gradientShapeGradient shape Options: wash, spotlight | select | "spotlight" |
gradientColorGradient color | color | "#93c5fd" |
gradientStrengthGradient strength 0–60Step 1 | number | 17 |
gradientXGradient horizontal position 0–100Step 1 | number | 94 |
gradientYGradient vertical position 0–100Step 1 | number | 70 |
gradientSpreadGradient spread 30–100Step 1 | number | 72 |
Toast Stack
Toast Stack displays instance-local notifications with actions, promise states and optional swipe dismissal. The default Toast presentation is 420 px wide with neutral Arclen UI surfaces, semantic status icons and a stronger gradient that follows each status icon. Mouse hover or keyboard focus expands the stack.
Install and delivery
Run npx arclen-ui add toast-stack in your application. Keep the complete components/toast-stack directory, including its manifest, stylesheet, assets and notices. The React adapter needs your application's React and React DOM; the component declares no additional runtime packages. Vanilla JavaScript and standalone HTML do not need React. Fonts use the system stack and the component makes no network requests.
The examples below run in a plain browser host bundled with esbuild; the React example uses React 19.2.8. They assume an application entry beside components/. Adjust relative import paths to your project. The installed root exports ToastStack, Component and ToastStackProps. Import controller types and framework-neutral functions from components/toast-stack/src/core. The React adapter imports its stylesheet; vanilla imports it explicitly. A bundler must support TypeScript, JSON and CSS imports.
For HTML delivery, use Copy HTML or download the HTML archive. Copied HTML contains its styles and script. In an archive, keep component.html, component.css, component.js and the included assets together so relative paths resolve. The script enhances the supplied markup; do not mount that same host a second time. For application callbacks and programmatic notifications, use the React or vanilla controller.
React example
Save this complete component as Example.tsx and render it from your application's React root.
'use client';
import { useRef, useState } from 'react';
import { ToastStack } from './components/toast-stack';
import type { Controller } from './components/toast-stack/src/core';
export default function Example() {
const notifications = useRef<Controller | null>(null);
const [ready, setReady] = useState(false);
const [result, setResult] = useState('Ready to archive');
function archive() {
notifications.current?.notify({
title: 'File archived',
description: 'You can restore it from the archive.',
action: {
label: 'Undo',
onClick: async () => { setResult('File restored'); },
},
});
}
return (
<>
<button type="button" disabled={!ready} onClick={archive}>Archive file</button>
<output>{result}</output>
<ToastStack
title="Workspace ready"
showClose
onReady={(controller) => {
notifications.current = controller;
setReady(true);
}}
/>
</>
);
}Keep the controller local to this mounted component. The adapter destroys it on unmount; do not retain it for later calls. Component is an alias for ToastStack. Settings are optional props. className and style apply to the host; paused suspends active motion and remaining notification time. onReady, onAction and onDismiss are API inputs, not serializable settings.
React settings props own the complete settings snapshot. Removing a settings prop restores its manifest default. Changing a settings prop also replaces settings applied through controller.update. Configuration applied in onReady remains until a settings prop changes. Callback, className, style and paused changes do not replace settings. Existing cards and their lifetimes survive settings-prop updates.
Configured vanilla example
This complete browser entry creates its own host and controls. Bundle it as main.ts and load the resulting script and CSS in an HTML page with a body.
import { mount } from './components/toast-stack/src/core';
import './components/toast-stack/src/styles.css';
const host = document.createElement('div');
host.style.cssText = 'position:relative;min-height:320px;width:100%';
const add = document.createElement('button');
add.type = 'button';
add.textContent = 'Archive file';
const stop = document.createElement('button');
stop.type = 'button';
stop.textContent = 'Remove notifications';
const result = document.createElement('output');
result.textContent = 'Ready to archive';
document.body.append(add, stop, result, host);
const notifications = mount(host, {
title: 'Workspace ready',
placement: 'container',
position: 'top-right',
width: 440,
duration: 0,
showClose: true,
gradientMode: 'status',
gradientStrength: 8,
}, {
onDismiss: (_id, reason) => { result.textContent = `Dismissed: ${reason}`; },
});
add.onclick = () => {
const id = notifications.notify({
title: 'File archived',
type: 'success',
action: {
label: 'Undo',
closeOnAction: false,
onClick: async () => { result.textContent = 'File restored'; },
},
});
notifications.updateToast(id, { description: 'Available in your archive.' });
};
stop.onclick = () => {
notifications.destroy();
add.disabled = true;
stop.disabled = true;
result.textContent = 'Notifications removed';
};Action handlers run in order: the notification's action.onClick, then the instance's onAction. Both may be asynchronous. A successful action dismisses its card unless closeOnAction is false. A thrown error or rejection displays errorLabel as an error status and retains the card. Actions with neither callback are disabled. Dismissal calls the notification's onDismiss and then the instance's onDismiss; errors in those handlers do not prevent removal.
Promise example
This complete browser entry uses a local asynchronous operation. Replace saveWorkspace with your application's work. Bundle it separately from the vanilla example.
import { mount } from './components/toast-stack/src/core';
import './components/toast-stack/src/styles.css';
const host = document.createElement('div');
const button = document.createElement('button');
button.type = 'button';
button.textContent = 'Save workspace';
const result = document.createElement('output');
result.textContent = 'Not saved';
document.body.append(button, result, host);
const notifications = mount(host, { title: 'Workspace ready', showClose: true });
async function saveWorkspace() {
return { name: 'Design workspace' };
}
button.onclick = async () => {
const operation = notifications.notifyPromise(saveWorkspace(), {
loading: 'Saving changes…',
success: async (value) => `Saved ${value.name}`,
error: 'Could not save changes',
});
const outcome = await operation.settled;
result.textContent = outcome.status === 'fulfilled'
? `Saved: ${outcome.value.name}`
: 'Save failed';
};
window.addEventListener('pagehide', () => notifications.destroy(), { once: true });notifyPromise returns an ID and a settled promise. After valid creation, settled resolves with the original operation outcome: fulfilled with value, or rejected with reason. Message resolvers may return a string or a promise of one. If a resolver throws, rejects or returns invalid text, the card uses the captured error label and the outcome also contains displayError. Invalid loading text can throw during creation.
Omit messages to use loadingLabel, successLabel and errorLabel, captured when the operation starts. Loading cards do not time out. Settlement changes the same card to success or error and starts the current configured duration. An intervening update, dismissal or destroy prevents stale asynchronous display updates; the original promise remains observed. Destroy does not cancel application work.
Controller and notification inputs
Each mount or React instance owns its notifications; there is no global notification dispatcher.
notify(input) returns an instance-local ID. Providing an active ID updates that card; an exiting ID throws until removal. Capacity is 100 active or queued cards.
updateToast(id, patch) validates before applying changes and returns false for a missing, exiting or destroyed card. Omitted or undefined fields retain values. Set description, action or onDismiss to null to clear them. An explicit duration restarts the timer; ordinary edits preserve it. Leaving loading starts the current configured duration.
dismiss(id?) dismisses one card or all dismissible cards. Dismissal reasons are action, close, swipe, escape, timeout and programmatic. dismissible: false blocks user and programmatic dismissal, but does not disable a finite timeout.
update(settings) merges a partial settings patch. Undefined values are omitted; unknown keys and null values are invalid. Settings-owned cards follow content settings; programmatically added cards keep their content. A duration-setting change affects future lifetimes, not an already-running timer.
pause() and resume() control manual suspension. React paused, document-hidden and container-offscreen suspension remain independent.
focus() focuses this instance's list and expands it. destroy() removes owned DOM, listeners, timers, observers and animations. Repeated destruction is safe.
A programmatic notification requires a nonblank title of at most 240 characters. Optional ID, description and action-label limits are 100, 1000 and 60 characters. Types are default, success, info, warning, error, loading and custom. Notification duration accepts 0–30000 milliseconds. Zero persists. Queued cards start consuming lifetime when first shown. action accepts label, onClick and closeOnAction; onDismiss receives the ID and reason.
Settings and appearance
The generated API reference lists all serializable settings from component.json, including their defaults, choices and bounds. It is the settings reference for React, vanilla and HTML. Callback functions, notification IDs, pending promises and controller state are not exported settings.
resolveSettings(input) returns a complete validated settings object with fresh array values. Keep that object when exporting configuration. To restore manifest settings, pass resolveSettings() to controller.update. This resets settings; it does not recreate dismissed cards or clear application notifications. In React, restore the settings props instead. Inspector Reset restores manifest configuration; preview size, pause and replay are host controls.
The component's default lifetime is 4000ms. A catalogue preview can hold its demonstration open; exported notifications still use their configured duration. Use duration 0 deliberately for persistent content.
Toast, Compact and Banner are presentation choices. Banner is an optional wide preset with larger type and an offset close button; it is not the default. The 11 presets are Toast, Compact, Monochrome, Action, Semantic, Dark, Expanded, Headless, Container, Loading and Banner. Presets supply settings, not a separate renderer. Headless is a styled variant with a wrapper and controls, not an unstyled render-prop API.
The Library palette provides neutral Arclen UI surfaces with semantic icon accents. Theme auto follows the system. Dark mode uses richer green, blue, amber and red status icons; each Status gradient uses the same colour. Custom palette values remain independent. Version 1.0.1 defaults to Status Spotlight at 17% strength, with its origin at 94% horizontally and 70% vertically and a 72% spread. The tint sits toward the lower right. Wash provides a broader treatment across the surface height. Success, info, warning and error use the same tint as their icons; default and loading notifications retain a neutral tint. Strength ranges from 0% to 60%. The Monochrome preset keeps the original neutral Spotlight at 4%, while Compact and Headless disable it. Gradient modes are off, neutral, status and custom; strength, position and spread control a static surface tint. Gradient controls do not animate it. Higher strength can reduce contrast. Check your chosen strength, colors and background; arbitrary custom colors are not guaranteed to meet a contrast target.
Blank configured region and action labels display as Notifications and Undo. Blank promise labels display as Saving changes…, Changes saved and Could not save changes. Resolved settings retain the blank source values; display fallbacks do not rewrite exports.
Placement and responsive layout
Six positions combine top or bottom with left, center or right. Viewport placement anchors to the viewport. Container placement uses the receiving host's width and positioning context; give that host enough height for the stack because the component does not assign host height. Width is limited by available space and configured insets. Compact insets apply at the configured breakpoint.
Long content wraps and cards grow. Toast and Banner can move their action to a separate row in narrow containers. Banner's configured padding is the vertical inset; wide standard cards add 8px on the left and 10px on the right. At 600px or below, Banner uses the configured padding capped at 24px on all sides. Headless uses its own wrapper padding. These are responsive relationships rather than additional settings.
Keyboard, touch and announcements
Notifications do not take focus when added. Alt+T enters the last interacted live instance in the document, or the first mounted instance. Tab reaches visible cards and enabled controls. Focus expands the stack and pauses notification lifetime. Escape dismisses the focused dismissible card. When removal occurs with focus inside that card, a still-connected invoker previously saved by focus() receives focus.
A polite live region announces title and description changes. Decorative status icons and the loader are hidden from assistive technology. Queued cards and collapsed older cards stay out of the tab order. This is not a screen-reader or physical-device certification; test your application's announcements and focus flow with its target assistive technologies.
Mouse hover expands the stack and pauses lifetime according to their respective settings. Optional horizontal swipes dismiss cards while vertical gestures remain available for scrolling. Buttons and keyboard dismissal remain alternatives. Coarse-pointer styles enlarge controls to at least 44px. Keep the host clear of overlapping application controls.
Reduced motion, suspension and static HTML
Reduced motion or animate: false removes spatial travel, status-replacement fades and continuous loader animation. It does not stop notification lifetime. Explicit pause freezes active motion and remaining time; hover and focus pause lifetime while useful entrance motion can continue. Hidden documents suspend active time. Offscreen suspension applies to container placement with a nonzero host rectangle outside the viewport.
Committed swipe travel uses 200ms ease-out. Regular travel duration and easing control entrances, stack movement and cancelled swipe returns. Interrupted reversals shorten according to active eased progress. exitRemovalDelay independently controls removal after dismissal.
render(settings) returns escaped semantic static HTML. Include src/styles.css when using it directly. Content remains readable without enhancement; actions are disabled and close buttons appear after mount. mount replaces only its direct fallback section and preserves other host children. Toast Stack's HTML fallback is readable notification content rather than a duplicate poster.
Without matchMedia, the core takes the reduced-motion path. Missing animation APIs use immediate state changes where necessary. Without ResizeObserver or IntersectionObserver, resize and scroll listeners provide passive layout or visibility updates; content changes outside those events may need an application update. Without PointerEvent, swipe enhancement is absent while buttons remain available.
Credits and licence
Toast Stack code and CSS are original Arclen UI work, copyright 2026 Arclen, under the MIT licence in LICENSE. The crossed-line close mark and twelve-bar CSS loading indicator are original Arclen UI drawings.
Status icons by Iconsax, created by Vuesax / Lusaxweb. The four integrated V1 Linear glyphs have separate proprietary Free licence terms; the component's MIT licence grants no icon ownership or sublicence. Keep NOTICE.md, the working Iconsax attribution link, assets/ICONSAX-LICENSE.md and assets/icon-provenance.json with redistributed packages. Do not extract the glyphs into loose files, an icon pack or an icon library.
Copied HTML includes companion icon credits outside the notification region, with the retained terms and provenance in a disclosure. Keep those credits readily locatable; they may live in your product's documentation area. React rendering does not insert this companion documentation, so retain attribution in your distributed documentation.
The preview runs the component’s own JavaScript. It respects reduced motion and pauses when off screen. The HTML bundle includes a static fallback.
Every setting in this panel comes from the component manifest. Preview size, pause and replay stay in the inspector.