Alert
BasicFeedback
<co-alert>Alert is an inline banner for information, success, warnings, errors, the read-only lock, access denied and break-the-glass.
import { Alert } from 'health-components';
Examples
Tones
Dismissible
Ai Notice
Usage
<Alert tone="warning" title="Prior authorization expires in 6 days" actions={<Button size="sm">Request Extension</Button>}>PA-2026-11873 covers 20 visits; 12 used.</Alert>
<Alert tone="lock">Your role (Biller) can view this screen but not edit it.</Alert>
When to use
- A message about this screen or record that must stay visible: coverage inactive, chart restricted, role is read-only.
When not to use
- Confirmation of an action that just finished: Toast.
- Blocking decisions: Modal.
Variants and states
| Variant | What it is |
|---|---|
| info | primary-strong on primary-soft. |
| success | success-strong on success-soft. |
| warning | ink on warning-box, warning-line border. |
| error | danger-ink on danger-soft. |
| lock | The read-only banner: "Your role (Biller) can view this screen but not edit it." |
| denied | Permission missing for a part of the screen. |
| btg | Break the glass: restricted chart, reason required, access is logged. |
| note | Neutral grey note. |
| ai | AI notice. |
Accessibility
- error, denied and btg use role alert; others role status.
- Every tone has its own icon.
Do and don't
- Do: Lock text names the role and the missing permission.
- Do: Break the glass states who normally has access and that the reason is audited.
- Don't: Stacking more than two alerts at the top of a screen.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
tone | AlertTone | 'info' | 'info' | 'success' | 'warning' | 'error' | 'lock' | 'denied' | 'btg' | 'note' | 'ai' |
title | ReactNode | none | Bold first line |
children | ReactNode | none | Body text |
actions | ReactNode | none | Buttons under the body |
onDismiss | () => void | none | Shows a Dismiss (x) button that calls this |
Also accepts native attributes, including defaultChecked, defaultValue, autoFocus, plus className and event handlers on the root element.
Angular, Vue and HTML
Register the elements once (Angular guide), then use <co-alert>. Attributes take strings; arrays and objects are set as properties (Angular [prop], Vue :prop) or as JSON attributes. Callbacks are DOM events with the value in event.detail.
Angular template
<co-alert tone="…" default-checked [defaultValue]="defaultValue" (co-dismiss)="onDismiss($event.detail)">…</co-alert>
| Kind | Name | Description |
|---|---|---|
| attribute | tone | 'info' | 'success' | 'warning' | 'error' | 'lock' | 'denied' | 'btg' | 'note' | 'ai'; default 'info' |
| attribute | default-checked / defaultChecked | |
| property / JSON attribute | default-value / defaultValue | |
| attribute | auto-focus / autoFocus | |
| event | co-dismiss | Shows a Dismiss (x) button that calls this; default none (React: onDismiss) |
| slot | title | Bold first line; default none Plain text also works as the `title` attribute. |
| slot | (default) | Body text; default none |
| slot | actions | Buttons under the body; default none Plain text also works as the `actions` attribute. |