NG Kit

Alert

Fully customizable, reusable alert component styled with Bootstrap CSS. Designed for standalone usage, tree-shakable imports, and reactive state via Angular signals. Configure the alert type, visibility, dismiss behavior, and custom classes.

Overview

Import AlertComponent and drop an <alert> element into your template with the message projected as content. Set type to choose the contextual style, toggle visibility with isOpen, and control dismissal with dismissible, dismissOnTimeout, and dismissTimeout. Listen to closed to react when the alert is dismissed.

  • The alert is tree-shakable: only imported features are included in your bundle.
  • All inputs are reactive and support Angular signals.
  • For more customization, use the class input to add custom styles.

API

Selectors

alert, lib-alert

Inputs

NameTypeDefaultDescription
typeAlertType'info' Alert style: 'info', 'primary', 'secondary', 'success', 'warning', 'danger', 'dark', 'light'
isOpenbooleantrueIs the alert visible
dismissiblebooleantrueShow an inline "Close" button
dismissOnTimeoutbooleantrueDismiss the alert after the timeout
dismissTimeoutnumber5000Timeout in ms before auto-dismiss
classstring''Additional CSS classes

Outputs

NamePayloadDescription
closedvoidEmits when the alert is closed

Requires Bootstrap styles to be loaded for the alert to render correctly.