Message
vig-message
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).
Custom content
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.
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.
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"]
| Part | Element | data-state |
|---|---|---|
root | info, success, warning, error … | |
icon | showIcon ). | — |
content | — | |
heading | — | |
text | text ). | — |
close | closable ). | — |
Accessibility
errorandwarningmessages haverole="alert"and are announced immediately; the other variants userole="status"and are announced politely.[live]="false"drops the role where something else announces the message, asvig-toasterdoes.- 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 (aclosedhandler may focus something else instead).
API
Message
vig-messageInline 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.
| Name | Type | Default | Description |
|---|---|---|---|
closable | boolean | false | — |
closeAriaLabel | string | undefined | undefined | — |
heading | string | undefined | undefined | Optional bold heading line above the body. |
live | boolean | true | Whether the message is a live region ( |
showIcon | boolean | true | — |
text | string | undefined | undefined | Body text; projected content is used when omitted. |
title | string | undefined | undefined | Deprecated: Use `heading`; `title` is also the native tooltip attribute. Still honored when `heading` is unset, and never shown as a tooltip. — |
variant | MessageVariant | 'info' | — |
| Name | Payload | Description |
|---|---|---|
closed | void | — |