App components / Alerts & toasts
Banner
A full-width message across the top of the app, one at a time: maintenance, a failed payment, a new feature. The countdown version counts down in days, hours and minutes for trial ends and launches.
MembersReact · Vue · HTMLFigma: Alerts & toasts
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.
Scheduled maintenance on Sunday from 02:00 to 04:00 UTC. Saving may be slow.
Saved views are here. Keep a filter and its columns, then share it.
Sync with Salesforce is running 12 minutes behind.
We couldn't charge the card ending 4242. Update it to keep Northwind running.
The app starts here.
Installation
Examples
Countdown
Accent for a trial ending, ink for a launch.
Your trial ends in
The app starts here.
Northwind 3.0 goes live in
The app starts here.
Motion
Built on Ochre's ease-out curves. With reduced motion switched on, everything still works, it just doesn't move.
01A banner opens its height with a slower ease-out when it appears, so the app below slides down instead of jumping.
02Dismissing folds it away in 200 ms before onDismiss runs.
03On the countdown, each number rises into place when it changes.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| status | "neutral" | "accent" | "warning" | "danger" | "neutral" | Banner tint and icon. Warning and danger are announced as alerts. |
| children | ReactNode | – | The message, one sentence. |
| action | ReactNode | – | Usually one BannerAction (Learn more), a link with href or a button. |
| onDismiss | () => void | – | Shows the dismiss button and is called after the banner folds away. |
| icon | ReactNode | false | – | Replaces the status's icon; false hides it. |
| <CountdownBanner to> | Date | string | number | – | When the countdown ends. It ticks in days, hours and minutes. |
| tone | "accent" | "ink" | "accent" | Countdown banner: the accent tint, or the ink band for launches. |
| label / endedLabel | ReactNode | "Your trial ends in" / "Your trial has ended" | Countdown banner: the words before the numbers, and what shows once time is up. |
| onEnd | () => void | – | Countdown banner: called once when the time runs out. |
Usage
Use it for
- Something that affects the whole app right now, above every page: maintenance, an outage, an overdue invoice.
- Accent for news worth a moment; warning and danger for things that stop work.
- Countdown for a deadline the whole account shares: a trial ending, a launch going live.
Avoid
- More than one banner at a time; show the most serious and queue the rest.
- Anything about one page or one record: use an Alert there.
- Confirming an action: use a Toast.