Toast

Ephemeral notifications fired imperatively from anywhere — no context, no wiring.

Import#

import { Toaster, toast } from "astralis-ui";

Mount one <Toaster /> near your app root (inside AstralisProvider), then call toast(...) from any event handler, effect, or async flow. The store is module-level, so it works outside React trees too.

Options: actions, sticky toasts, dismiss#

toast() API#

CallReturnsDescription
toast(options)idFull-control form.
toast.info/success/warning/error(title, options?)idStatus shorthands.
toast.dismiss(id?)Close one toast, or all when called with no id.

Options#

OptionTypeDefaultDescription
titleReactNodeRequired headline.
descriptionReactNodeSupporting copy.
status"info" | "success" | "warning" | "error""info"Icon, hue, ARIA role.
colorSchemeall 11 schemesfrom statusHue override.
durationnumber | null5000Auto-dismiss ms; null keeps it until dismissed. Hovering pauses the timer.
closablebooleantrueShow the ✕ button.
action{ label, onClick }Action button after the text.

<Toaster /> props#

PropTypeDefaultDescription
placement"top-start" | "top-center" | "top-end" | "bottom-start" | "bottom-center" | "bottom-end""bottom-end"Screen edge the stack grows from.
maxnumber5Newest-first cap on visible toasts.

Accessibility#

  • Each toast renders role="alert" (error/warning — assertive) or role="status" (info/success — polite), inside a labelled role="region" outlet.
  • Hover pauses the auto-dismiss timer and resumes with the remaining time, so slow readers aren't raced.