bloxa

Toast

FREE

Notifications from anywhere with toast(): types, actions, promises, pause on hover and swipe to dismiss.

Installation

Terminal
npx @bloxa/cli add toast
# or: npx shadcn@latest add @bloxa/toast

Packages installed automatically: motion

Examples

Types

Hover pauses the timer; swipe sideways to dismiss.

Undo action

Promise

The same toast moves from loading to the result.

API reference

Every component also accepts the props of the element it renders.

toast()

toast.success / info / warning / error / loading / promise / dismiss. Returns an id; calling with the same id updates it.

PropTypeDefaultDescription
descriptionReactNode—Second line.
durationnumber4000Lifetime in ms; Infinity stays open.
action{ label, onClick }—One action button.
iconReactNode | null—Custom icon, or none.
idstring | number—Id to update an existing toast.

Toaster

Mount once in the root layout.

PropTypeDefaultDescription
position"top-left" | "top-center" | "top-right" | "bottom-left" | "bottom-center" | "bottom-right""bottom-right"Where on screen.
durationnumber4000Default lifetime in ms.
visiblenumber4Toasts visible at once.
closeButtonbooleantrue× on every toast.
showProgressbooleantrueTime-left bar.