Components · Notifications

Inline notification

An inline notification gives feedback right where the user is working: next to a form, a quantity field or a delivery estimate. It stays in the page until the user acts or the state changes. It never disappears by itself.

How to build an inline notification and the CSS behind it. The files are eco-design-system/notifications.css and notifications.js.

Basic Usage

Link the shared files once per page. Never copy the rules into a page.

StepWhat to do
1. Link<link rel="stylesheet" href="/eco-design-system/notifications.css"> and <script src="/eco-design-system/notifications.js"></script>. Link button.css first. The script makes the × work.
2. MarkupCopy a recipe below and put it next to the thing it is about.
3. ChooseStatus class, emphasis class (weak is the default), and inline-notification--small for Small.
4. AnnouncePut it in a region with aria-live="polite" when it appears after an action.

Inline notification

The markup has no motion. The closing animation is set in Motion on Examples & Guidelines.


API

Classes

ClassUse
inline-notification--{info|success|warning|error}The status.
inline-notification--{strong|weak}The emphasis.
inline-notification--smallSmall. No Actionable layout.

Custom properties and attributes

NameUse
--n-close-ease, --n-close-durationClosing motion. Defaults: ease-accelerate-generic, duration-fast-3.
data-n-close="fade"On the notification or an ancestor: fade only, no height collapse.
n-dismissedEvent, bubbles, fired when the notification is hidden.

Things to know

  • The × is the Close icon button; the script hides the notification with hidden.
  • Small · Weak exists only for Informational and Warning.
  • Buttons inside a notification are always 32px high, also when button.css is on the page.

CSS / Tailwind

The component is one CSS file and one script, shared by every notification. Link them, never copy them. The code below is read from the files the page links, so it is always what you see.