App components / Alerts & toasts
Alert
An inline notice that sits in the page. Flat is one tinted card; Soft and Card use the tray-and-card anatomy, with the status on the tray and the title on its strip, and the detail and actions on a raised card. Soft goes inside content, Card when it stands alone.
Code
The component itself, ready to drop into your project. Switch between React, Vue and plain HTML; every version uses the same Tailwind classes on Ochre's tokens.
Your trial ends in 3 days
Saved views are rolling out
Domain verified
Sync is running behind
Payment failed
Installation
Examples
Flat tones
Neutral for context, info and accent for tips, then success, warning and danger.
Read-only workspace
Maintenance on Sunday
Saved views are here
Domain verified
Sync is running behind
Payment failed
With an action
One action that fixes the problem, and a way to dismiss it.
Your card expires in 6 days
Without a title
A single line for small notices inside forms and panels.
Motion
Built on Ochre's ease-out curves. With reduced motion switched on, everything still works, it just doesn't move.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| tone | "neutral" | "info" | "accent" | "success" | "warning" | "danger" | "neutral" | Colour and icon. Warning and danger are announced as alerts. |
| variant | "flat" | "soft" | "card" | "flat" | Flat is one tinted card. Soft tints the tray and puts the title on it; Card does the same on a plain tray and colours only the icon. |
| title | ReactNode | – | One short line in the strong text colour. |
| children | ReactNode | – | The detail under the title: what happened and what to do. |
| icon | ReactNode | false | – | Replaces the tone's icon; false hides it. |
| action | ReactNode | – | Usually one S secondary Button that fixes the problem; a link Button on Soft and Card. |
| onDismiss | () => void | – | Shows a Dismiss button and is called when it's pressed. |
| dismissLabel | string | "Dismiss" | Label for the dismiss button, such as Got it. |
Usage
Use it for
- Something about this page the person should know before they carry on: a failed sync, an expiring card, a plan limit.
- Accent for tips and news that are useful but not urgent; info for neutral facts with a blue icon.
- Soft inside a page or panel, Card when the alert stands alone, Flat for the quietest single line.
- One alert per area. Put the most serious one first.
Avoid
- Confirming an action the person just took: use a Toast.
- Danger for anything that isn't broken or blocking.
- Stacking several alerts at the top of a page; combine them.