Toast

Toast is a neobrutalist React component from Cruise UI. Feedback that pops up in a corner or edge you choose (bottom-right by default): copied, saved, something went wrong. Install it with npx shadcn@latest add @cruiseui/toast.

Install

Terminal

npx shadcn@latest add @cruiseui/toast

First time? Installation shows the one-off components.json setup (the @cruiseui registry) and how to turn the theme on.

Example

Corners

When to use it

When to use

All feedback after an action. Auto-dismiss after ~3s; errors stay until closed.

When not to

Information people need to act on later (put it on the page). Never use alert().

Props

CruiseToast

PropTypeDefaultDescription
tone?CruiseToastTone"info"—
titleReactNode——
children?ReactNode——
onDismiss?(() => void)——
className?string——

CruiseToaster

PropTypeDefaultDescription
position?CruiseToastPosition"bottom-right"Default spot for every toast; each toast can override it.
children?ReactNode——

CruiseToastViewport

PropTypeDefaultDescription
position?CruiseToastPosition"bottom-right"Where the stack sits.
childrenReactNode——

Usage

  • Wrap your app in CruiseToaster once, then call useCruiseToast().toast({ title, description, tone, position }) anywhere.
  • position is top-left, top-center, top-right, bottom-left, bottom-center or bottom-right (the default). Set it on the Toaster for every toast, or on one toast to override it.
  • Top stacks grow down with the newest on top; bottom stacks grow up with the newest at the bottom. Below 640px every position is full width with 16px gutters.
  • For your own toast (e.g. CruiseAchievementToast), pass render: (dismiss) => <YourToast onDismiss={dismiss} />.

Accessibility

  • role="status" (role="alert" for danger), so screen readers announce it.
  • The coloured left bar is backed by a title (Done!, Something went wrong).
  • Errors stay until closed; under reduced motion toasts fade instead of sliding.