Xzero UI
Pro library

Toast

Brief confirmation for a completed background action.

$ pnpm dlx shadcn@4.23.0 add @xzero-ui/toast
Live · keyboard ready

When to use

When not to use

Installation

Register both Xzero UI namespaces in your project's components.json:

{
  "registries": {
    "@xzero-ui": "https://mcp.xzero.co.uk/r/{name}.json",
    "@xzero-ui-pro": "https://mcp.xzero.co.uk/r/pro/{name}.json"
  }
}
npx shadcn@4.23.0 add @xzero-ui/toast

Install xzero-foundation once, and import @/components/xzero/foundation.css in your app root. No Xzero token is used by this snapshot. For sample portraits, photos, fonts, or logos, download https://mcp.xzero.co.uk/install-assets.mjs and run node xzero-install-assets.mjs <receiving-project>.

Usage

import Toast from "@/components/xzero/toast/toast";

export function SavedToast() {
  const [open, setOpen] = useState(false);
  return (
    <>
      <button type="button" onClick={() => setOpen(true)}>Save</button>
      <Toast open={open} onOpenChange={setOpen} title="Changes saved" description="Synced to all devices." />
    </>
  );
}

API reference

Toast

A single swipeable notification with a drawn check, auto-dismiss, and morphing copy. Default export.

PropTypeDefaultDescription
title (required)string–Headline. Changes crossfade while shown.
descriptionstring–Supporting line.
openbooleantrueWhether the toast is shown. Setting it true again after a dismiss re-raises it.
onOpenChange(open: boolean) => void–Called with false on close, swipe, or timeout. Auto-dismiss only runs when this is provided.
durationnumber4500Milliseconds before auto-dismiss. 0 or less disables it.

Keyboard interactions

KeysAction
Tab then EnterReaches and activates the dismiss button.

Accessibility

Motion

Responsive behavior

Performance

Notes for AI

Also in messages

Guidance for AI tools

Toast: Brief confirmation for a completed background action. Follow the declared prop types and do not invent props. Keep keyboard access, reduced motion support, and both light and dark themes intact when adapting it.

Full library index: https://ui.xzero.co.uk/llms.txt

Browse all components