Toaster provides a toast notification system for displaying brief, auto-dismissing feedback messages. It supports success, error, info, warning, and loading variants. Styling follows the Figma Toasts component (2624:114500) — tinted surfaces per variant, 64px min height, inline actions, and no leading type icon.
Toast surfaces use semantic tokens from @marmoui/ui:
| Variant | Token |
|---|---|
| Info | --color-toast-info-bg (bg-toast-info-bg) |
| Success | --color-toast-success-bg (bg-toast-success-bg) |
| Warning | --color-toast-warning-bg (bg-toast-warning-bg) |
| Error | --color-toast-error-bg (bg-toast-error-bg) |
| Neutral | --color-toast-neutral-bg (bg-toast-neutral-bg) |
Text uses --color-ink-dark for titles and --color-ink for descriptions and actions. Error toasts use --color-toast-on-error for light text on the destructive surface.
Operation succeeded, error from a background task, brief info. Toasts auto-dismiss — they're for things that don't require the user to act.
toaster.loading('Sending...') for longer-than-instant operations. Update or dismiss when the operation finishes.
If the message must stay visible until the user acts, use Alert (page-level) or Banner (inline).
Validation errors belong inline with the field, via the Field component's error prop.
Anything with a button or link the user must click → use Dialog or ConfirmationDialog. Toasts can be missed.
| You want… | Use this |
|---|---|
| Persistent informational note (page-level) | Alert |
| Inline contextual message (e.g. above a form) | Alert (with appropriate variant) |
| Critical confirmation requiring "yes" | ConfirmationDialog |
| Field-level validation error | Field error prop |
| Loading state on a specific button | Button loading (not a toast) |
| Page-blocking notice | Dialog with no dismiss option |
npm install @marmoui/uiyarn add @marmoui/uipnpm add @marmoui/uibun add @marmoui/uiAdd the <Toaster /> component to your app layout, then use the toaster utility to trigger notifications:
import { Toaster, toaster } from '@marmoui/ui';
// In your layout
<Toaster />
// Trigger toasts anywhere
toaster.success('Campaign published successfully');
toaster.error('Failed to send email');
toaster.info('New contacts imported');
toaster.warning('Approaching storage limit');
toaster.loading('Sending emails...');
// With description and inline action (Figma-style Undo)
toaster.info('Action completed', {
description: 'Click undo to revert.',
action: { label: 'Undo', onClick: () => toaster.dismiss() },
});Static Figma-aligned bars plus live triggers. Surfaces use toast tokens — no hard-coded colors.
<div className="flex flex-wrap gap-2">
<Button onClick={() => toaster.success('Saved successfully')}>Success</Button>
<Button onClick={() => toaster.error('Something went wrong')}>Error</Button>
<Button onClick={() => toaster.info('3 new contacts imported', {
action: { label: 'Undo', onClick: () => toaster.dismiss() },
})}>Info + Undo</Button>
<Button onClick={() => toaster.warning('Storage almost full')}>Warning</Button>
</div>Toast messages should be 1 short sentence. Users scan them quickly.
Match the toast variant to the message type (success, error, info, warning).
If the error blocks the user's workflow, use an Alert or Dialog instead.
Limit visible toasts to 3-5. Too many notifications overwhelm users.
aria-live="polite".