Alert · callouts

Callouts with a title, text, actions and hidden details — four looks, a dismiss that folds the alert away, a controlled open state and an auto-close countdown that waits while you read.

variant for the four below

A new version is available

Reload to get the latest features and fixes.

Changes saved

Your profile was updated a moment ago.

Actions · details · dismiss

Tip

Dismiss me — I fold away and the content below slides up.

Controlled · auto-close · compact

open is a signal; this one closes itself after 6 s — hover to hold it

Invite sent

[email protected] will get an email in a minute.
Compact · neutral · outline — for quiet notes in dense layouts.
No icon, an accent bar, and rich content in the body.

Usage

JavaScript
import { signal } from "./index.js";import { Alert } from "./components/alert.js"; // kind: "info" | "success" | "warn" | "error" | "neutral"// variant: "soft" (default) · "outline" · "accent" · "solid"Alert({ kind: "success", title: "Changes saved", children: "Your profile was updated." }) // buttons under the text; the first is the main one, in the kind's colourAlert({ kind: "warn", title: "Unsaved changes", actions: [  { label: "Publish", onClick: publish }, { label: "Discard", onClick: discard },] }) // a cause behind "Show details"Alert({ kind: "error", title: "Build failed", details: log }) // dismissing folds it away — then onClose runsAlert({ kind: "info", children: "Tip", onClose: () => showTip.set(false) }) // controlled, and closing itself after 6 s (hover / focus holds the countdown)const open = signal(true);Alert({ kind: "success", open, autoClose: 6000, title: "Invite sent" })