Skip to content

Alert

Displays a callout for user attention.

Basic Usage

Example

Variants

Use the variant prop to control the visual style of the alert.

  • Default: Default style.
  • Primary: Primary color style.
  • Success: Success color style.
  • Destructive: Destructive (error) color style.
  • Warning: Warning color style.
  • Info: Info color style.
Example

Custom Content (Closable)

You can easily add custom content, such as a close button, using composition.

Example

Custom Content (Collapsible)

You can build complex interactions like collapsible alerts using standard Vue features.

Example

With Icons

You can add icons by placing them as the first child of the Alert component.

Example

Theming

Global Customization (BrConfigProvider)

You can override default CSS variables via the theme prop of BrConfigProvider.

Example

Local Customization (TailwindCSS)

You can directly override styles using TailwindCSS utility classes.

vue
<template>
  <BrAlert class="bg-indigo-500 hover:bg-indigo-600">
    <BrAlertTitle>Custom Class</BrAlertTitle>
    <BrAlertDescription>Custom styled alert.</BrAlertDescription>
  </BrAlert>
</template>

API

Components

  • BrAlert: The main container.
  • BrAlertTitle: The title component.
  • BrAlertDescription: The description component.

BrAlert Props

NameTypeDefaultDescription
variantstring'default'Visual style variants: default, primary, success, destructive, warning, info
classstringundefinedCustom classes