Toast
Global notification toasts in four types - success, warning, error, and info. Slides up from the bottom center, auto-dismisses after 5 seconds, and renders via a portal so it sits above everything else.
Installation
npx stepwise-ui add toast
Setup
Add <Toaster /> once in your app root. Then call toast.* anywhere - no context provider needed.
Types
Click the buttons to see each toast type.
With action
Pass an action object to replace the dismiss × with a labeled button. Clicking it runs onClick and auto-dismisses the toast.
Sound
Set sound: true to play a toaster "pop + ding" when the toast appears - synthesized with the Web Audio API, so there are no audio files to ship. It is off by default; toggle it per toast.
Dismiss
Toasts auto-dismiss after 5 seconds (configurable via duration). toast.show() returns an id for programmatic dismissal.
Props
toast.show() accepts:
PropTypeDescription
type"success" | "warning" | "error" | "info"Icon and color scheme.
titlestringMain message.
descriptionstringOptional secondary line.
action{ label: string; onClick: () => void }Adds an action button. Replaces the dismiss ×.
soundbooleanPlay a toaster pop + ding on appear. Default: false.
durationnumberAuto-dismiss delay in ms. Default: 5000.