Const Unreviewed<Toaster> — the mounted notification region. Keep one mounted somewhere in
your app (a portal is fine); toasts are added imperatively through the store
(Toaster.manager, or a createToaster() you pass as toaster). It
subscribes to the store and renders each toast through the reconciler, so
React or Preact renders the toast nodes.
Announcement is opt-in per toast (add(render, { politeness })), not a
blanket live region on the whole toaster.
Requires @antadesign/anta/elements to be imported (client-side only) to
register the underlying custom elements.
<Toaster /> // mount once, keep it mounted
// A bare string is auto-wrapped in a dismissible Banner:
Toaster.manager.add(() => 'Saved', { placement: 'bottom-right' })
// Or toast a Banner yourself and wire its dismiss to the toast:
Toaster.manager.add((id) => (
<Banner tone="success" message="Saved" onDismiss={() => Toaster.manager.dismiss(id)} />
))
Readonly Unreviewedmanager: ToasterManagerThe default toast store, bound to a <Toaster> mounted with no toaster.
The
<Toaster>component, carrying the default toast store as a static:Toaster.manager.add(render, opts). A function-with-a-static (likeComponent.displayName) — no class component, which would couple to a renderer.