Skip to content

Alert

Displays important alert messages.

Basic usage

Display information that needs attention, suitable for brief warning prompts.

Types

There are four types of warnings: info, success, warning, and error. which has no icon by default.

Effects

Card provide five different themes: dark、light、plain、up and down. Using effect to change, default is up.

Customizable close button

Customize the close button as texts or other symbols.

With icon

Displaying an icon improves readability.

With description

Besides the required 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.

With icon and description

This is an example with both icon and description.

Sizes

Besides default size, tu-alert component provides three additional sizes for you to choose among different scenarios. Use attribute size to set additional sizes with mini, small, large.

Alert API

Alert Attributes

NameDescriptionTypeDefault
titleThe title of alertString-
typeThe type of alertString-
descriptionDescriptive textString
closableWhether alert can be dismissedBooleantrue
centerWhether content is placed in the centerBooleanfalse
close-textCustomized close button textString-
show-iconWhether a type icon is displayedBooleanfalse
effectThe effect of alertStringup
sizeThe size of alertStringmedium

Alert Events

NameDescriptionType
closeTrigger when alert is closedFunction

Alert Slots

NameDescription
defaultContent of the alert description
titleContent of the alert title