v0.3.1 StableFoundation ComponentReact 18 & 19Zero Runtime CSS

Toast

Transient feedback with a readable live message.

Interactive preview

Usage

import { Toast } from "@devvy-ui/react";

<Toast open={saved} onOpenChange={setSaved} message="Project saved." />

API reference

Native HTML attributes, className, style and a forwarded ref are supported. Component-specific props:

PropTypeDefaultDescription
openbooleanrequiredWhether the notification is visible.
messagestringrequiredLive status/alert text.
onOpenChange(open: boolean) => voidrequiredDismissal callback.
durationnumber5000Dismissal delay; 0 disables timing.
toneneutral / dangerneutralStatus or urgent alert semantics.

Accessibility & behavior

Platform Behavior & Guidelines

No focus stealing. Auto dismissal pauses while hovered/focused or the page is hidden. Use duration 0 for persistent messages; reserve danger for urgent failures.

Source ownership

Run npx @devvy-ui/cli init once in your React project, then add the source:

npx @devvy-ui/cli add toast

Make the source yours.

Start from the canonical implementation used by the package and registry. Change the code, keep the MIT notice, and build the behavior your project needs.

Toast.tsxREACT / TSX

Edit your own copy. Downloaded source uses your changes; the component preview above uses the shipped version. Run the source installer first to include shared helpers.