Live demo
Demo source
Use a notification for a short update that doesn't need page-level prominence, such as a confirmation or a heads-up. Notifications appear in a corner of the viewport and stack. For information that must stay on the page until people act, use an alert instead.
Anatomy
An information notification with seven callouts: 1 the container with its coloured edge, 2 the icon, 3 the title, 4 a timestamp, 5 the message, 6 the close button and 7 the Cancel and Confirm actions.
- Container takes its colours from
feedback, andemphasis(mediumorhigh) sets how strongly it stands out. - Icon matches the feedback type. Use
iconto choose another one. - Title comes from
headingor theheadingslot. - Timestamp appears in the design, but there is no timestamp property. Put the time in the title or message if it matters.
- Message comes from
messageor thecontentslot. - Close button (optional,
dismissible). - Actions go in the
actionsslot. Keep them to one focused choice, such as Undo.
Slots
Use heading for a custom title and an optional timestamp, content for the
message, and actions for a focused response. Slot content replaces the
corresponding text property. The design's timestamp is composed in the title
area; there is no separate timestamp property in code.
Emphasis
Use emphasis="high" when an update needs stronger visual prominence, and
"medium" for a quieter message. Emphasis changes the visual weight; it does
not change severity or dismissal timing. Both levels follow the selected
Spark or Ocean theme.
Feedback type
feedback | Meaning |
|---|---|
information | Helpful context or guidance. |
warning | A potential problem that needs attention. |
success | Confirmation that an action completed. |
error | A problem the person may need to resolve. |
neutral | A general update without a severity. |
The design sometimes abbreviates information as “info”; the property value
is information. Keep meaningful text and an appropriate icon alongside the
colour so the message does not depend on colour recognition.
Best practice
Keep updates brief and non-blocking, and choose the feedback type to match the message. Reserve lasting, critical information for an in-page alert. Use one focused response such as Undo instead of competing actions.
Dismissal and announcements
Show notifications through your framework's notification provider, or place
them in an nv-notificationcontainer
and call show() and dismiss(). The provider's duration closes a
notification after a set time; the current providers default to a duration
of 0, so there is no automatic timeout unless you configure one. A standalone
nv-notification has no timer. dismissible adds a manual close button. This
differs from the design overview's description of automatic dismissal.
Errors and warnings use an assertive alert announcement; other feedback types use a polite status announcement. Keep the message understandable without its visual styling, and do not make an automatically disappearing message the only place to find important information.