Skip to contentEnma

Components

Toast

Live demo

How to use it

A short confirmation or error that appears after an action, with an optional single action.

  • Provide title, optionally description, tone (neutral, positive, negative) and action (label, onClick).
  • Positioning and timing are the app's job: bottom center on mobile, bottom right on desktop, about 4 seconds, longer if it has an action.
  • Write the outcome, not the mechanism: "Invoice sent", never "Successfully sent!".

Don't: stack more than two, or put critical errors only in a toast.

In every theme

Follows the mode picked in the header.
Graphite
Invoice sent
Northwind will get it in a minute.
Glass
Invoice sent
Northwind will get it in a minute.
Paper
Invoice sent
Northwind will get it in a minute.
Mineral
Invoice sent
Northwind will get it in a minute.
Enamel
Invoice sent
Northwind will get it in a minute.
Ember
Invoice sent
Northwind will get it in a minute.

Code

React
import { Toast } from 'enma/react';

<Toast tone="positive" title="Invoice sent" description="Northwind will get it in a minute." action={{ label: 'Undo', onClick: undo }} />
<Toast tone="negative" title="The card was declined. Try another." />
Plain HTML
<div class="e-toast e-sq e-toast--positive" role="status">
  <span class="e-toast__icon" aria-hidden="true"><!-- check icon --></span>
  <div class="e-toast__body"><div class="e-toast__title">Invoice sent</div></div>
</div>

Props

ToastProps

Props of ToastProps
PropTypeDefaultDescription
title requiredReact.ReactNode
descriptionReact.ReactNode
tone'neutral' | 'positive' | 'negative''neutral'
iconIconName
action{ label: string; onClick?: () => void }
classNamestring
styleReact.CSSProperties

↑ ↓ to move, Enter to open, Esc to close

Keyboard shortcuts

Open the command palette
Ctrl then K
Search
/
Show keyboard shortcuts
?
Close the top overlay
Esc
Go to Home
G then H
Go to Themes
G then T
Go to Playground
G then P
Go to Components
G then C
Go to Guides
G then G
Go to Samples
G then S