Feedback
Glass Alert
An inline message in four tones that can fold itself away when dismissed.
Preview
Heads up
Your trial ends in three days.
Saved
Every change is in.
Almost full
You have used 92% of your storage.
Payment failed
Update your card to keep your plan.
Installation
Install the package once, then import the parts you use into a standalone component.
Install
npm install ngx-vitreo @angular/cdk @floating-ui/domImport
import { GlassAlert } from 'ngx-vitreo';
@Component({
imports: [GlassAlert],
// ...
})Usage
Usage
<glass-alert title="Heads up">Your trial ends in three days.</glass-alert>
<glass-alert tone="success" title="Saved">Every change is in.</glass-alert>
@if (shown()) {
<glass-alert dismissible title="New version" (dismiss)="shown.set(false)">
Reload to get it.
</glass-alert>
}
<glass-alert title="Custom icon">
<svg glassAlertIcon viewBox="0 0 20 20">…</svg>
The tone's icon is replaced.
</glass-alert>API reference
GlassAlert
glass-alert
| Input | Type | Default | Description |
|---|---|---|---|
tone | 'info' | 'success' | 'warning' | 'danger' | 'info' | Colour, icon and announcement role. |
title | string | None | A bold line above the message. |
icon | boolean | true | false shows no icon. Project an element marked glassAlertIcon to replace the tone's icon. |
dismissible | boolean | false | Shows a close button that folds the alert away. |
(dismiss) | void | None | Emits once the alert has folded away; remove the alert here and track each alert by a stable key. |
dismissLabel | string | 'Dismiss' | Accessible name of the close button. |
role | string | 'alert' for warning and danger, else 'status' | Overrides the announcement role. |