Messaging

Message

Messages are compact, floating snippets of feedback anchored near the content they refer to.

Components · Messaging

A message is a small, elevated, inline-sized snippet — a step up from inline field help, a step down from an alert. Namirial messages are built from --nm-message-* tokens defined in namirial-theme.css, keep a neutral card background across every intent, and only recolor their text, icon, and link.

Default message
Draft savedUndo

Overview

A message is a compact, self-sized snippet of feedback — it hugs its content instead of stretching full-width like an alert, and it floats with a shadow rather than sitting flush in the layout. It's meant to sit near what it describes: beside a button, under a small action row, next to a list item.

When to use

Use a message when:

  • The feedback is short (a few words) and tied to a specific, local action or spot on the page.
  • You want a floating, self-contained snippet rather than a full-width banner.

Consider another component when:

  • The message applies to the whole page or section — use Alert instead.
  • The feedback should appear briefly and disappear on its own, independent of scroll position — use Toast.
  • The feedback belongs to a single form field — use the field's own help/error text.

Anatomy

A message is an icon, a short text run, and an optional inline link — all on one row, in a card with a fixed shadow.

Tokens and values that drive each part

PartRoleSource
ContainerFill (fixed, neutral)--nm-message-bg
ContainerShadow--nm-message-shadow — 0 4px 16px
ContainerRadius / padding / gapborder-radius: 8px · padding: 8px 12px · gap: 16px
IconColor--nm-message-additional — recolored per intent
TextColor--nm-message-fg — recolored per intent
LinkColor / weight--nm-message-additional, font-weight: 600, underlined

Intent variants

Message ships seven intents, defaulting to info. Unlike Alert, the container fill never changes — only the icon, link, and text color shift.

Primary message
Secondary message
Accent message
Info message
Positive message
Warning message
Negative message

Content types

.nm-message__link shares the icon's --nm-message-additional color, so both recolor together and stay distinct from the plain body text.

Draft savedUndo

Text only

3 items in your cart

Light & dark theme

The message card fill and shadow are explicitly remapped under .dark, since — unlike Alert — its background doesn't come from the intent-driven callout scale.

Light data-theme="light"
Draft savedUndo
Dark data-theme="dark"
Draft savedUndo

Both previews are locked — they don't follow the page theme switcher.

Do & don't

✓Do
Draft savedUndo
Keep the message short and place it right next to the action it confirms.
✕Don't
Your draft has been saved successfully and will be available the next time you open this document.
Don't use a message for a long explanation — switch to Alert or inline help text.
✓Do
Link expired
Use the intent that matches what actually happened.
✕Don't
Link expired
Don't pair a negative icon with the default intent's color — icon and color must agree.

Accessibility

Semantics

  • Give the message role="status" so assistive tech picks it up as a polite live-region update without stealing focus.
  • Mark the icon aria-hidden="true" — it duplicates the color/text signal already carried by the message.

Focus & dismissal

  • A message that appears in response to an action shouldn't steal keyboard focus — announce it, don't move focus to it.
  • If a message includes an "Undo" or similar link, make it a real focusable <button>/<a>, not a styled <span> with a click handler.

Token reference

TokenRole
--nm-message-bgContainer fill — fixed, not intent-driven
--nm-message-shadowDrop shadow color
--nm-message-fgBody text color — recolored per intent
--nm-message-additionalIcon and link color — recolored per intent

Implementation

No JavaScript is required for a static message.

<link rel="stylesheet" href="namirial-theme.css">

<div class="nm-message nm-message--positive" role="status">
  <span class="nm-message__icon" aria-hidden="true"><!-- icon --></span>
  <span>Draft saved</span>
  <span class="nm-message__link">Undo</span>
</div>

CSS classes

ClassValuesDefault
nm-message--{intent}primary · secondary · accent · info · positive · negative · warning — omit for info— (info)
nm-message__iconLeading icon slot, 24×24px—
nm-message__linkInline emphasized link, shares icon color—