Message

An inline status message that stays in the page flow, next to the content it is about. Use it for persistent feedback such as form errors or account notices; for short-lived confirmations use a toast.

  • vig-message
Import
import { Message } from '@vigdx/ui/message';

Severities

variant sets the severity and its icon: info (default), success , warning and error . Pass the body as text and an optional bold heading (formerly title , now deprecated: it also set the native tooltip).

Your trial ends in 5 days.

Payment received. Thank you!

Custom content

Without text , the projected content becomes the body, e.g. a list of errors or a sentence with a link. The neutral variants ( primary , secondary ) suit plain notes; showIcon hides the icon.

Prices exclude VAT. See the billing FAQ for details.

Closable

closable adds a dismiss button. The message hides itself and emits closed ; remove it with @if to bring it back later or to remember the choice.

New: dark mode

Switch themes from the toolbar at the top of the page.

Styling hooks

Internal elements carry a stable data-part and the component's data-scope; both are public API, so removing one is a breaking change. Select a part by both, e.g. [data-scope="message"][data-part="root"] { … }: the pair stays within this component when kit components nest, and also reaches parts in overlay panels, which render outside the host. State is exposed through aria-* and, where listed, a data-state; literal values are checked by the API gate, values computed from the component's state follow its documented types. Other data-* attributes listed below (such as data-opening while an overlay animates) are API too. See Customizing.

Scope: [data-scope="message"]

Message styling hooks
Part Element data-state
root The message box. info, success, warning, error …
icon The leading status icon ( showIcon ). —
content Wrapper of the heading and text. —
heading The bold heading line. —
text The body text ( text ). —
close The close button ( closable ). —

Accessibility

  • error and warning messages have role="alert" and are announced immediately; the other variants use role="status" and are announced politely. [live]="false" drops the role where something else announces the message, as vig-toaster does.
  • Live regions announce changes, not content present on page load. To announce a message, render it in response to the event (e.g. a failed submit) rather than hiding it with CSS.
  • The icon is decorative; the severity must also be clear from the text or the heading.
  • The dismiss button is named by closeAriaLabel (localized “Dismiss” by default). When it had focus, closing moves focus to the next focusable element after the message, or the previous one at the end of the page, so keyboard users keep their place (a closed handler may focus something else instead).

API

Message

vig-message component

Inline alert for contextual feedback (PrimeNG p-message territory). Error/warning announce assertively via role="alert"; the rest use role="status". Closing hides the message and emits closed; when focus was on the close button it moves to the next focusable element after the message (else the previous one), so keyboard users keep their place instead of falling back to the top of the page.

Message props
Name Type Default Description
closablebooleanfalse
—
closeAriaLabelstring | undefinedundefined
—
headingstring | undefinedundefined

Optional bold heading line above the body.

livebooleantrue

Whether the message is a live region (alert/status). Turn it off where something else announces it, as vig-toaster does, so it is not read twice.

showIconbooleantrue
—
textstring | undefinedundefined

Body text; projected content is used when omitted.

titlestring | undefinedundefined

Deprecated: Use `heading`; `title` is also the native tooltip attribute. Still honored when `heading` is unset, and never shown as a tooltip.

—
variantMessageVariant'info'
—

Are you sure?