---
name: element-plus-alert
description: Element Plus Alert component (el-alert) API documentation. Triggers when user wants to use, implement, or asks about el-alert or Alert component.
---

# Alert 组件 API

## Attributes

| Name        | Description                              | Type                                                                       | Default |
| ----------- | ---------------------------------------- | -------------------------------------------------------------------------- | ------- |
| title       | alert title.                             | ^[string]                                                                  | —       |
| type        | alert type.                              | ^[enum]`'primary' (2.9.11) \| 'success' \| 'warning' \| 'info' \| 'error'` | info    |
| description | descriptive text.                        | ^[string]                                                                  | —       |
| closable    | whether alert can be dismissed.          | ^[boolean]                                                                 | true    |
| center      | whether content is placed in the center. | ^[boolean]                                                                 | false   |
| close-text  | customized close button text.            | ^[string]                                                                  | —       |
| show-icon   | whether a type icon is displayed.        | ^[boolean]                                                                 | false   |
| effect      | theme style.                             | ^[enum]`'light' \| 'dark'`                                                 | light   |

## Events

| Name  | Description                   | Type                                     |
| ----- | ----------------------------- | ---------------------------------------- |
| close | trigger when alert is closed. | ^[Function]`(event: MouseEvent) => void` |

## Slots

| Name          | Description                       |
| ------------- | --------------------------------- |
| default       | content of the alert description. |
| title         | content of the alert title.       |
| icon ^(2.9.7) | content of the alert icon.        |

## 参考

- 官方文档: https://element-plus.org/en-US/component/alert.html
