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.
<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.
<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.
<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.
<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.
@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.
<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:
| Prop | Type | Default |
|---|---|---|
Optional description text for the banner. | string | |
To customize the element, provide it using the directive instead:
<div q-alert-banner-description>...</div> | ||
When true, renders a close button that calls closed when clicked. | boolean | false |
To customize the close button, provide it using the directive instead:
<button q-alert-banner-close-button>...</button> | ||
Optional heading text for the banner. | string | |
To customize the element, provide it using the directive instead:
<div q-alert-banner-heading>...</div> | ||
string<div q-alert-banner-description>...</div>
booleantrue, renders a close button that calls closed when clicked.<button q-alert-banner-close-button>...</button>
string<div q-alert-banner-heading>...</div>
Composite API
q-alert-banner-root
| Prop | Type | Default |
|---|---|---|
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' | 'info' |
The visual style of the banner. | | 'strong' | 'strong' |
Event emitted when the close button is clicked. | void |
string'ltr' | 'rtl'
| 'info'
| 'success'
| 'warning'
| 'danger'
| 'neutral'
| 'strong'
| 'subtle'
voidq-alert-banner-icon
| Prop | Type |
|---|---|
Override the icon displayed in the banner. When this prop is omitted,
the icon is determined by the emphasis prop. | LucideIconData |
LucideIconData| Attribute / Property | Value |
|---|---|
class | 'qui-alert-banner__icon' |
data-part | 'status-icon' |
data-scope | 'alert-banner' |
class'qui-alert-banner__icon'data-part'status-icon'data-scope'alert-banner'q-alert-banner-heading
| Attribute / Property | Value |
|---|---|
class | 'qui-alert-banner__heading' |
data-part | 'heading' |
data-scope | 'alert-banner' |
class'qui-alert-banner__heading'data-part'heading'data-scope'alert-banner'q-alert-banner-description
| Attribute / Property | Value |
|---|---|
class | 'qui-alert-banner__description' |
data-part | 'description' |
data-scope | 'alert-banner' |
class'qui-alert-banner__description'data-part'description'data-scope'alert-banner'q-alert-banner-close-button
| Attribute / Property | Value |
|---|---|
class | 'qui-alert-banner__close-button' |
data-part | 'close-button' |
data-scope | 'alert-banner' |
class'qui-alert-banner__close-button'data-part'close-button'data-scope'alert-banner'q-alert-banner-action
| Attribute / Property | Value |
|---|---|
class | 'qui-alert-banner__action' |
data-part | 'action' |
data-scope | 'alert-banner' |
class'qui-alert-banner__action'data-part'action'data-scope'alert-banner'