Alert
Displays a callout for user attention.
Component Features
- 🎨 Multiple Variants: Supports
default,primary,success,destructive,warning,infovisual variants. - ❌ Closable: Supports adding a close button with flexible implementation via the composable API.
- 📐 Collapsible: Supports collapsing long content for detailed information display.
- 🖼️ Icon Support: Supports adding icons to enhance visual expression.
- 🎨 Theme Customization: Based on
BrConfigProviderfor global theming and TailwindCSS local overrides.
Basic Usage
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.
Custom Content (Closable)
You can easily add custom content, such as a close button, using composition.
Custom Content (Collapsible)
You can build complex interactions like collapsible alerts using standard Vue features.
With Icons
You can add icons by placing them as the first child of the Alert component.
Theming
Global Customization (BrConfigProvider)
You can override default CSS variables via the theme prop of BrConfigProvider.
Local Customization (TailwindCSS)
You can directly override styles using TailwindCSS utility classes.
API
Components
BrAlert: The main container.BrAlertTitle: The title component.BrAlertDescription: The description component.