Theme
Install with your agentnpx shadcn@4.23.1 add @goop/meadow-toast

Toast

Free

A short notice at a corner of the app that confirms an action and goes by itself, with an optional action such as Undo, for React and Tailwind CSS. Free, MIT.

Remove a note and press Undo in its toast (or Ctrl/Cmd+Z) within eight seconds: the note comes back where it was and takes the focus. Let the toast go and the removal is kept for good. Raise a plain toast and an error toast; several stack. Pick a look to see one card still: a picture and a link, a status glyph, the error toast with or without its words or a picture. The notes live in the page only; “removed for good” only counts; the picture is a plain block of our own.

When to use

  • A short notice at a corner of the app that confirms an action and goes by itself, with an optional action such as Undo.
  • Also called: notification or snackbar.

Installation

Paste the prompt below into your coding agent. It reads Goop's install steps, installs the part and its tokens once, then reuses this same Toast on every screen instead of drawing a new one: the same height, the same focus ring, the same spacing.

Terminal
npx shadcn@4.23.1 add @goop/meadow-toast
PROMPT
Add the Goop Toast to this project. The install steps are at https://goop.so/docs/install.md

Usage

TSX
import { ToastIndicator, ToastAction, ToastButton } from '@/components/ui/goop/toast';

import type { ComponentProps } from 'react';
import { Button } from '@/components/ui/goop/button';
import { Toast, Toaster, toast } from '@/components/ui/goop/toast';

const OFFLINE = {
  title: 'You are offline',
  description: 'Your notes stay on this device and are sent when the connection is back.',
} satisfies ComponentProps<typeof Toast>;

function App() {
  return (
    <>
      <NoteActions save={() => Promise.resolve()} archive={() => {}} restore={() => {}} />
      <Toaster />
    </>
  );
}

function NoteActions({
  save,
  archive,
  restore,
}: {
  save: () => Promise<void>;
  archive: () => void;
  restore: () => void;
}) {
  return (
    <div className="flex gap-2">
      <Button
        onClick={() =>
          toast.promise(save, {
            loading: 'Saving the note',
            success: 'Note saved',
            error: { title: 'Couldn’t save the note', description: 'Check the connection and try again.' },
          })
        }
      >
        Save
      </Button>
      <Button
        variant="outline"
        onClick={() => toast.undo({ title: 'Note archived', onUndo: restore, onCommit: archive })}
      >
        Archive
      </Button>
      <Button variant="ghost" onClick={() => toast.warning(OFFLINE)}>
        Go offline
      </Button>
    </div>
  );
}
  • Fits: account, app, settings (their recipes).
  • Raise a notice with toast, never by drawing a Toast: every kind takes the title alone or the card's object, toast.success('Saved') or toast.error({ title: 'Couldn’t save', description: 'The server did not answer.' }) (the object also takes action, id, duration and closeButton). Mount <Toaster /> once for the whole app, in its root (App.tsx or the root layout, beside the screens), never once per page: toast() shows nothing without it.
  • height, width, padding, gap, corner, background, shadow, text, motion: add no class for these.

API reference

Options
OptionTypeWhat it does
variantdefault | info | success | warning | destructive | loading = default
  • Each option with its sentence: toast--options.md
  • Types: ToastOptions = Omit<ComponentProps<typeof Toast>, 'id'> & { id?: string | number; duration?: number; toasterId?: string; closeButton?: boolean }; UndoToastOptions = Omit<ToastOptions, 'action'> & { onUndo: () => void; onCommit?: () => void; undoLabel?: string; shortcut?: string | false }
Parts
PartWhat it is
ToastIndicatorA status icon at the toast's start, a pack icon by its name, for a notice of your own (mark); decorative, as the title says what happened; its props: toast--indicator.md
ToastActionThe link a notice ends with (action={<ToastAction href>Words</ToastAction>}); also takes href?: string
ToastButtonA button a notice ends with (action={<ToastButton onClick>Undo</ToastButton>}); its props: toast--button.md
ToasterThe toast region, mounted once near the root of the app, or once per named region (id); its props: toast--toaster.md
toastShows a toast card in the app's Toaster and returns its id; toast.error(…) (the toast library's own name) or toast.destructive(…) (the theme's status word) shows the error card; toast.success, toast.warning, toast.info and toast.loading the other kinds
  • Class recipes (cva): toastVariants (Toast)
  • data-slot values (to select a part by): toast, toast-action, toast-badge, toast-badge-icon, toast-body, toast-close, toast-content, toast-description, toast-header, toast-icon, toast-indicator, toast-media, toast-spinner, toast-status, toast-title, toast-title-row

ToastButton

A button a notice ends with (action={<ToastButton onClick>Undo</ToastButton>}).

TSX
import { ToastButton } from '@/components/ui/goop/toast';

Options

  • Also takes: type?: 'button' | 'submit' | 'reset'; onClick?: (event: MouseEvent) => void; disabled?: boolean; loading?: boolean = false; loadingLabel?: string = 'Loading'

ToastIndicator

A status icon at the toast's start, a pack icon by its name, for a notice of your own (mark); decorative, as the title says what happened.

TSX
import { ToastIndicator } from '@/components/ui/goop/toast';

Options

  • icon: IconName — A pack icon name.

Toast: every option

TSX
import { Toast } from '@/components/ui/goop/toast';

Options

  • variant: default (default), info, success, warning, destructive, loading
  • title: ReactNode — The notice's few words.
  • description?: ReactNode — A line or two under the title.
  • mark?: ReactNode — A glyph at the start, a <ToastIndicator icon>, in place of the kind's mark; not drawn when a media is given.
  • media?: ReactNode — A 36 px picture at the start, the caller's image, in place of any glyph; a kind given it and no mark keeps its mark before the title.
  • action?: ReactNode — What the notice ends with: a ToastAction link, or a ToastButton (on the title's line with no description).
  • closeLabel?: string = 'Close' — The close cross's accessible name.
  • kindLabel?: string — The words a screen reader hears before the title, saying the kind: "Error", "Warning", "Success", "Info" or "Loading" by default, none for the plain notice; an empty string says none.
  • onDismiss?: () => void — Called when the close cross is pressed; given, the cross is drawn at the end of the title's line.

Toaster

The toast region, mounted once near the root of the app, or once per named region (id).

TSX
import { Toaster } from '@/components/ui/goop/toast';

Options

  • id?: string — The region's name: it shows only the notices raised with toast({ toasterId }) of that name; none, only those raised with no name.

Motion

  • The part sets its own motion: add no transition or animation of your own.

Notes for AI

Give your coding agent this page as text instead of screenshots: the parts, the options, the states and the keys. An agent that reads the real part builds the real part, not a lookalike.

goop.so/themes/meadow/components/toast.md · the page as Markdown
Theme
Install with your agentnpx shadcn@4.23.1 add @goop/meadow-toast

Where would you like to start?

Free · now

The Goop plugin

A design system for your AI coding agent, so screen ten matches screen one.

/plugin marketplace add goop-so/skillsthen /plugin install goop@goopCodex, Cursor, ChatGPT, the Claude app and more: Connect Goop
FreePro

The components

Every part live, with its props, its keys and what an agent sees. Whole page and app templates, working with sample data.