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.
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:
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
| Part | Role | Source |
|---|---|---|
| Container | Fill (fixed, neutral) | --nm-message-bg |
| Container | Shadow | --nm-message-shadow — 0 4px 16px |
| Container | Radius / padding / gap | border-radius: 8px · padding: 8px 12px · gap: 16px |
| Icon | Color | --nm-message-additional — recolored per intent |
| Text | Color | --nm-message-fg — recolored per intent |
| Link | Color / 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.
Content types
With a link
.nm-message__link shares the icon's --nm-message-additional color, so both recolor together and stay distinct from the plain body text.
Text only
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.
Both previews are locked — they don't follow the page theme switcher.
Do & don't
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
| Token | Role |
|---|---|
| --nm-message-bg | Container fill — fixed, not intent-driven |
| --nm-message-shadow | Drop shadow color |
| --nm-message-fg | Body text color — recolored per intent |
| --nm-message-additional | Icon 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
| Class | Values | Default |
|---|---|---|
nm-message--{intent} | primary · secondary · accent · info · positive · negative · warning — omit for info | — (info) |
nm-message__icon | Leading icon slot, 24×24px | — |
nm-message__link | Inline emphasized link, shares icon color | — |