Alert
Display success, warning, information and error alerts with the original appearance, HTML title/description and three slots. Supports Chalk/OEM component themes.
Themes / icons / closing / centering
Supporting descriptions
Custom slots
Interactive example
On-demand import
import NfAlert from '@94ai-plus/nf-alert'
import '@94ai-plus/nf-theme-chalk/nf-alert.css'
app.use(NfAlert)Types
import type { AlertProps, AlertType, AlertEffect, AlertInstance } from '@94ai-plus/nf-alert'
// AlertType: 'success' | 'warning' | 'info' | 'error'
// AlertEffect: 'light' | 'dark'
// AlertInstance: { close(): void }Attribute
| parameters | Description | Type | Optional value | Default value |
|---|---|---|---|---|
| title | Title, supports trusted HTML; can also be passed in via the title slot. | string | — | '' |
| description | Supporting text. It can also be passed in through the default slot, and the default slot takes priority. | string | — | '' |
| type | Alert type | string | success/warning/info/error | 'info' |
| closable | Can it be closed | boolean | — | true |
| close-text | Close button custom text | string | — | '' |
| showIcon | Whether to display the icon | boolean | — | true |
| center | Is the text centered? | boolean | — | false |
| effect | Visual theme | string | light/dark | 'light' |
Event
| event name | Description | callback parameters |
|---|---|---|
| close | Event triggered when alert is turned off | — |
Slot
| Name | Description | Slot parameters |
|---|---|---|
| default | Description | — |
| title | Title content | — |
| close | Custom close control | { close: () => void } |
Migration instructions
Reserves 8 properties, no-argument close event, and three slots. Fixed the problem of the description disappearing when the default slot and description are passed in at the same time, and changed it to slot priority; fixed the problem of repeatedly closing the trigger event after being hidden. After closing, updating properties will not automatically reopen. Please remount via key.
The close button is changed to a native button, which supports keyboard operations, accessibility labels in eight languages, and does not submit the form. The icons are changed to built-in SVG and do not rely on Element UI fonts. The close slot has a new close callback, and the instance has a new close() method. The effect controls the appearance of the prompt box and is independent of the white and black theme of the document/drill field.
