Skip to main content

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​

Storybook

Dismissible​

Storybook

Ai Notice​

Storybook

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​

VariantWhat it is
infoprimary-strong on primary-soft.
successsuccess-strong on success-soft.
warningink on warning-box, warning-line border.
errordanger-ink on danger-soft.
lockThe read-only banner: "Your role (Biller) can view this screen but not edit it."
deniedPermission missing for a part of the screen.
btgBreak the glass: restricted chart, reason required, access is logged.
noteNeutral grey note.
aiAI 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​

PropTypeDefaultDescription
toneAlertTone'info''info' | 'success' | 'warning' | 'error' | 'lock' | 'denied' | 'btg' | 'note' | 'ai'
titleReactNodenoneBold first line
childrenReactNodenoneBody text
actionsReactNodenoneButtons under the body
onDismiss() => voidnoneShows 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>
KindNameDescription
attributetone'info' | 'success' | 'warning' | 'error' | 'lock' | 'denied' | 'btg' | 'note' | 'ai'; default 'info'
attributedefault-checked / defaultChecked
property / JSON attributedefault-value / defaultValue
attributeauto-focus / autoFocus
eventco-dismissShows a Dismiss (x) button that calls this; default none (React: onDismiss)
slottitleBold first line; default none Plain text also works as the `title` attribute.
slot(default)Body text; default none
slotactionsButtons under the body; default none Plain text also works as the `actions` attribute.