Skip to content

KAlert

Displays important alert messages.

Install

bash
pnpm add @ikun-ui/alert
bash
yarn add @ikun-ui/alert
bash
npm install @ikun-ui/alert

Basic usage

Alert components are non-overlay elements in the page that does not disappear automatically.

Alert provides 4 types of themes defined by type, whose default value is info.

Customizable Close Button

Customize the close button as texts or other symbols.

Alert allows you to configure if it's closable. The close button text and closing callbacks are also customizable. closable attribute decides if the component can be closed or not. It accepts boolean, and the default is true. close event fires when the component is closed.

In addition, close slot will cover closeIcon.

With Icon

Displaying an icon improves readability.

Setting the showIcon attribute displays an icon that corresponds with the current Alert type.

In addition, icon slot will cover icon.

With Description

Description includes a message with more detailed information.

Besides the title attribute, you can add a description attribute to help you describe the alert with more details. Description can only store text string, and it will word wrap automatically.

Alert Props

NameTypeDefaultDescription
typesuccess | error | warning | infoinfoalert type.
titlestring''alert title.
descriptionstring''descriptive text.
showIconbooleanfalsewhether a type icon is displayed.
iconstring''The class name of the icon, following the unocss standard.
closablebooleantruewhether alert can be dismissed.
closeIconstringi-carbon-closecustomized close icon.
clsstring''Additional class for component
attrsany{}Additional attributes

Alert Events

NameDescriptionType
closetrigger when alert is closed.(event: PointerEvent)=> void

Alert Slots

NameDescription
defaultcontent of the description.
titlecontent of the title.
iconcontent of the icon.
closecontent of the close.

MIT Licensed