Component v1.1.0 Foundations

Alert

Semantic feedback message with variants and an optional dismiss action.

API Stable 2.1 WCAG notes Ready Dark mode
Selector
ui-alert
Package
@ngnova/ui/alert

Import

Standalone Tailwind v4
import { UiAlertComponent } from '@ngnova/ui/alert';

Usage & variants

Live examples use the public ui-alert API, paired with the exact snippet a product team would paste into an Angular app.

API Reference

Dismissible release status

Semantic feedback message with variants and an optional dismiss action.

Saved

Your component settings were updated.

Production guidance

Use these notes to decide when the component belongs in a product workflow and what to verify before shipping.

When to use

Use for page-level or section-level messages that should remain visible until resolved or dismissed.

Watch for

Use concise title text; long remediation copy belongs in the body.

Product recipes

Apply Alert in distinct, copyable product scenarios—not just an isolated component state.

Dismissible success

Dismiss emits openChange and dismissed.

Angular template ui-alert-recipe.example.html
1
2
3
<ui-alert variant="success" title="Saved" dismissible (dismissed)="trackDismiss()">
  Your settings were updated.
</ui-alert>

Validation summary

Place a persistent error summary before a form and link users to the fields that need attention.

Angular template ui-alert-recipe.example.html
1
2
3
4
5
6
<ui-alert variant="danger" title="Resolve 2 validation errors">
  <ul class="list-disc pl-5">
    <li><a href="#release-name">Enter a release name</a></li>
    <li><a href="#release-date">Choose a release date</a></li>
  </ul>
</ui-alert>

API Reference

Inputs and outputs are semver-sensitive public API. Keep examples aligned with this table.

Inputs

variant 'info'
'info' | 'success' | 'warning' | 'danger'

Semantic feedback treatment.

title ''
string

Optional heading text.

open true
boolean

Controls alert visibility and supports reopening dismissed alerts.

ariaRole ''
string

Overrides the default status/alert role.

dismissAriaLabel 'Dismiss alert'
string

Localized accessible name for the dismiss button.

dismissible false
boolean

Shows a close button and hides the alert when pressed.

Outputs

openChange OutputEmitterRef<boolean>

Supports two-way open binding for dismissible alerts.

dismissed OutputEmitterRef<void>

Emits after the dismiss button hides the alert.

Accessibility

  • Defaults to polite status semantics; danger uses the assertive alert role unless ariaRole overrides it.
  • The icon-only dismiss action has a localizable accessible name and a decorative SVG icon.

Keyboard behavior

  • The native dismiss button is reachable with Tab and activates with Enter or Space.

Testing guidance

  • Assert roles, all variants, openChange, dismissed output, and reopening behavior.
  • Use UiAlertHarness to locate an alert by title, read its role and visibility, or dismiss it through public behavior.