Toast

A brief outcome with an optional action.

  • Composed
  • Liquid Glass on iOS 26
  • In the first release
import { Toast, toastPrimitive } from "nitro-ui-sdk/toast";
HeroUI Native
Toast
Expo UI
Snackbar
  • Toast example screen, light appearance
    Light
  • Toast example screen, dark appearance
    Dark
  • Toast example screen, liquid glass appearance
    Liquid Glass
On this page

Toast announces a brief outcome with an optional action. Use Alert when the message should stay inline, or Dialog when the user has to make a decision.

Anatomy

import { Toast, createToaster } from "nitro-ui-sdk/toast";

const toaster = createToaster();
<Toast.Region toaster={toaster} dismissLabel="Dismiss"
  renderItem={(toast) => (
    <Toast.Item key={toast.id} toast={toast}>
      <Toast.Icon />
      <Toast.Message />
      <Toast.Action />
      <Toast.Dismiss />
    </Toast.Item>
  )}
/>;
Part Description
Region Positions the active stack, subscribes to the store and announces each revision.
Item Glass or opaque toast chrome and agent identity.
Icon Decorative intent glyph.
Message Outcome text.
Action Optional named action.
Dismiss Named button to remove the toast.

Usage

import { Toast, createToaster } from "nitro-ui-sdk/toast";

const toaster = createToaster();
toaster.show({ message: "Draft saved", intent: "success" });
<Toast.Region toaster={toaster} dismissLabel="Dismiss" />;

Variants and sizes

Intents are default, accent, success, warning and danger. Each has an icon, and icon can override it with an SF Symbol. The existing variant option also accepts info and error as aliases. Width follows the Region and height follows content. Set placement to top or bottom.

States

A toast can be timed, persistent or actionable. A disabled action remains visible and blocks dispatch. Identical passive messages refresh their timer. A same-ID replacement gets a new agent identity. With reduced motion, entry is immediate.

Controlled

Keep a stable toaster in the owner. Use subscribe and getSnapshot to read the current queue. Use show, dismiss or dismissAll to change it. Toast.Region subscribes automatically and accepts controlled placement.

Liquid Glass

Toast chrome uses MaterialView over the screen. It uses the opaque overlay surface when glass is off, unavailable or transparency is reduced.

Props

Region

Prop Type Default Description
toaster Toaster required Store to render.
placement ToastPlacement bottom Edge of the region’s parent.
layout SharedViewProps[“layout”] — Position overrides, including safe area offsets.
dismissLabel string Dismiss Default localized dismiss label.
styles ToastStyles — Part style resolvers.
api Controller — Controller binding.
onAnnounce (message, toast) => void native announce Announcement override.
renderItem (toast) => ReactNode default Item Custom item renderer.
children ReactNode active items Custom region body.

Item

Prop Type Default Description
toast ToastRecord required Current queue record.
part ToastPart item Style part to resolve.
layout SharedViewProps[“layout”] — Layout overrides.
dismissLabel string Region label Dismiss button name when the record has none.
agentId string toast ID Base for revision-scoped agent identity.
styles ToastStyles Region styles Item style overrides.
children ReactNode Icon, Message, Action, Dismiss Custom anatomy.

Icon, Message, Action, Dismiss

Prop Type Default Description
part ToastPart component part Style part to resolve.
children string or ReactNode configured content Message accepts a string. Action and Dismiss accept custom children.
label string item dismiss label Accessible name override for Dismiss.

Controller API

import { Toast, createToaster, toastPrimitive } from "nitro-ui-sdk/toast";

const toaster = createToaster();
const api = toastPrimitive.createApi();
<Toast.Region toaster={toaster} api={api} />;
Action Signature Result
show (input, source?) => string Enqueues or refreshes a toast and returns its ID.
dismiss (id, source?) => ActionStatus Removes a toast unless the handler vetoes it.
dismissAll (source?) => void Attempts to dismiss every active toast.
pressAction (id, actionId, source?) => ActionStatus Runs the enabled action and dismisses by default.
getItems () => readonly ToastRecord[] Reads the active queue.

Styles

import { Toast, createToaster } from "nitro-ui-sdk/toast";

<Toast.Region toaster={createToaster()}
  styles={{ item: ({ tokens }) => ({ style: { cornerRadius: tokens.radius.sheet } }) }} />;

Resolvers receive tokens, the current variant, content size and the fields count, hasError, glass and hasAction.

Accessibility

The region announces each new message once. Dismiss and action are named buttons, and the icon stays decorative. Success, warning and danger may play matching notification haptics when show receives the user source.

Agent API

Action Arguments Notes
dismiss None Removes the current toast revision.
press { actionId: string } Runs the enabled action. Supports an optional localized confirmation.

Secret toasts hide message content and actions from the agent.

Platform notes

iOS Android
Implementation Composed region with native semantics, animation and Liquid Glass where available. Composed region with native semantics and opaque chrome.
Verification iOS harness. Build and runtime verification require an Android NDK.