Alert Banner

A prominent notification component for displaying important information or system status messages. Alert banners span the full width of their container and use distinctive colors to indicate message severity.

import {AlertBannerModule} from "@qualcomm-ui/angular/alert-banner"

Examples

Simple

Use the simple API to create a banner using minimal markup.

Heading
Description
<div
  description="Description"
  dismissable
  heading="Heading"
  q-alert-banner
  (closed)="onClose()"
>
  <button
    emphasis="white-persistent"
    q-alert-banner-action
    q-button
    size="sm"
    variant="outline"
  >
    Action
  </button>
</div>

Composite

The composite API provides individual sub-components for custom layouts or when you need to render custom content within each slot.

Heading
Description
<div q-alert-banner-root (closed)="onClose()">
  <span q-alert-banner-icon></span>
  <div q-alert-banner-heading>Heading</div>
  <div q-alert-banner-description>Description</div>
  <div q-alert-banner-action>
    <button
      emphasis="white-persistent"
      q-button
      size="sm"
      variant="outline"
    >
      Action
    </button>
  </div>
  <button q-alert-banner-close-button></button>
</div>

Emphasis

The emphasis prop controls the banner's color scheme. The default is info. Each emphasis also determines the default icon.

info
success
warning
neutral
<div emphasis="info" heading="info" q-alert-banner></div>
<div emphasis="success" heading="success" q-alert-banner></div>
<div emphasis="warning" heading="warning" q-alert-banner></div>
<div emphasis="danger" heading="danger" q-alert-banner></div>
<div emphasis="neutral" heading="neutral" q-alert-banner></div>

Variant

The variant prop controls visual prominence. The default strong variant uses solid backgrounds for high visibility. The subtle variant uses muted backgrounds with borders.

info
success
warning
neutral
<div emphasis="info" heading="info" q-alert-banner variant="subtle"></div>
<div
  emphasis="success"
  heading="success"
  q-alert-banner
  variant="subtle"
></div>
<div
  emphasis="warning"
  heading="warning"
  q-alert-banner
  variant="subtle"
></div>
<div
  emphasis="danger"
  heading="danger"
  q-alert-banner
  variant="subtle"
></div>
<div
  emphasis="neutral"
  heading="neutral"
  q-alert-banner
  variant="subtle"
></div>

Dismissable

The banner is a controlled component. Set dismissable to render a close button, then handle visibility state via the closed output. With the composite API, use q-alert-banner-close-button.

Simple API
Composite API
@if (simpleVisible) {
  <div
    closeButtonAriaLabel="Close this banner"
    dismissable
    heading="Simple API"
    q-alert-banner
    (closed)="simpleVisible = false"
  ></div>
}

@if (compositeVisible) {
  <div
    closeButtonAriaLabel="Close this banner"
    q-alert-banner-root
    variant="subtle"
    (closed)="compositeVisible = false"
  >
    <span q-alert-banner-icon></span>
    <div q-alert-banner-heading>Composite API</div>
    <button q-alert-banner-close-button></button>
  </div>
}

Action

Pass a button using the q-alert-banner-action directive. Use size="sm" with emphasis="white-persistent" for strong banners, or emphasis="neutral" for subtle banners.

Strong
Use white-persistent emphasis for strong variant
Subtle
Use neutral emphasis for subtle variant
<div
  description="Use white-persistent emphasis for strong variant"
  heading="Strong"
  q-alert-banner
  variant="strong"
>
  <button
    emphasis="white-persistent"
    q-alert-banner-action
    q-button
    size="sm"
    variant="outline"
  >
    Take action
  </button>
</div>

<div
  description="Use neutral emphasis for subtle variant"
  heading="Subtle"
  q-alert-banner
  variant="subtle"
>
  <button
    emphasis="neutral"
    q-alert-banner-action
    q-button
    size="sm"
    variant="outline"
  >
    Take action
  </button>
</div>

API

q-alert-banner

The q-alert-banner directive extends the q-alert-banner-root directive with the following properties:

PropTypeDefault
Optional description text for the banner.
string
When true, renders a close button that calls closed when clicked.
boolean
false
Optional heading text for the banner.
string
Type
string
Description
Optional description text for the banner.
Type
boolean
Description
When true, renders a close button that calls closed when clicked.
Type
string
Description
Optional heading text for the banner.

Composite API

q-alert-banner-root

PropTypeDefault
Accessible label for the close button.
string
'Close'
The document's text/writing direction.
'ltr' | 'rtl'
"ltr"
Governs the color of the banner and its icon.
| 'info'
| 'success'
| 'warning'
| 'danger'
| 'neutral'
'info'
The visual style of the banner.
| 'strong'
| 'subtle'
'strong'
Event emitted when the close button is clicked.
void
Type
string
Description
Accessible label for the close button.
Type
'ltr' | 'rtl'
Description
The document's text/writing direction.
Type
| 'info'
| 'success'
| 'warning'
| 'danger'
| 'neutral'
Description
Governs the color of the banner and its icon.
Type
| 'strong'
| 'subtle'
Description
The visual style of the banner.
Type
void
Description
Event emitted when the close button is clicked.

q-alert-banner-icon

PropType
Override the icon displayed in the banner. When this prop is omitted, the icon is determined by the emphasis prop.
LucideIconData
Type
LucideIconData
Description
Override the icon displayed in the banner. When this prop is omitted, the icon is determined by the emphasis prop.

q-alert-banner-heading

q-alert-banner-description

q-alert-banner-close-button

q-alert-banner-action