Playground GitHub npm

Toast

Stacked notification queue (Rust-backed VecModel) with fade-out.

ui feedback

Preview

Installation

npx slintcn@latest add toast

Usage

import { Toaster, ToastQueue, ToastVariant } from "slintcn/components/toast.slint";

// Mount once at Window root:
Toaster { width: parent.width; height: parent.height; }

// Fire from anywhere:
ToastQueue.show("Event created", ToastVariant.success);

Properties

items in-out [ToastItem]

Live queue of toasts; usually managed by `ToastQueue`, not set directly.

show callback (string, ToastVariant)

Push a toast onto the queue with `(text, variant)`.

dismiss callback (int)

Remove the toast at the given index.

item in ToastItem

The toast data this row renders.

stack-index in int

Position in the stack (0 = bottom).

available-width in length

Width of the parent viewport; the toast clamps to fit.

available-height in length

Height of the parent viewport; used for stack positioning.

API

ToastVariantdefaultsuccesserror

Dependencies

theme only

Installed automatically as transitive dependencies of slintcn add toast.