Skip to content
🌏 Translated with the assistance of DeepSeek and ChatGPT

Alert

A message bar component used to display important information or feedback for actions.

Alert Types

The Alert supports various types: 'info' (default), 'success', 'warning', 'error', 'loading', 'normal', 'sakura' and 'notice'.

Info
Notice
Success
Warning
Error
Sakura
Loading
Normal
Hide source code

Alert Variants

The Alert has two style variants: 'plain' (default) and 'primary'.

Info
Notice
Success
Warning
Error
Sakura
Loading
Normal
Hide source code

Text Alignment

Set textAlign to control the alignment of the content: 'start', 'center', or 'end'.

Start
Center
End
Hide source code

Title

Use the title prop or title slot to show a prominent title above the content.

Title
Info
Title
Notice
Title
Success
Title
Warning
Title
Error
Title
Sakura
Title
Loading
Title
Normal
Hide source code

Closable

Enable closable to show a close icon; the component emits a close event when the icon is clicked.

Info
Success
Notice
Warning
Error
Sakura
Loading
Normal
Hide source code

Icon

Set the icon position via iconPlacement: 'start' or 'text-leading'; control icon visibility via showIcon; customize the icon via the icon slot.

No Icon
Custom Icon
Text Center & Icon Start
Text End & Icon Start
Hide source code

Custom Color

Set color to provide a custom primary color: the component generates a complete palette from it and the palette will take precedence over preset theme palettes. See Supported Color Parsing.

#3B82F6
#10B981
#F59E0B
#EF4444
Hide source code

Shape & Rounded Corner Border

Control the shape of the Alert component via shape.

borderRadius sets the Alert's rounded corners and takes precedence over shape, behavior follows CSS border-radius rules.

  • Single value or array length 1 → applies to all corners
  • Array length 2 → [top-left & bottom-right, top-right & bottom-left]
  • Array length 3 → [top-left, top-right & bottom-left, bottom-right]
  • Array length 4 → applies clockwise from top-left
Info
Success
Sakura
Hide source code

API

AlertProps

AttributeTypeOptionalDefaultDescriptionVersion
borderRadiusNumberOrPercentage | NumberOrPercentage[]TrueCorner radius, takes precedence over shape and behaves like CSS border-radius.0.1.0
shape'rect' | 'round'True'rect'Component shape, 'rect' or 'round'.0.1.0
variant'primary' | 'plain'True'plain'Style variant, 'primary' or 'plain'.0.1.0
type'info' | 'success' | 'warning' | 'error' | 'loading' | 'normal' | 'sakura' | 'notice'True'primary'Type (theme).0.1.0
textAlign'start' | 'center' | 'end'True'start'Text alignment, 'start' / 'center' / 'end'.0.1.0
titlestringTrueTitle text or provided via title slot.0.1.0
colorstringTrueCustom primary color. See Supported Color Parsing.0.1.0
closablebooleanTruefalseWhether to show close icon.0.1.0
iconPlacement'start' | 'text-leading'True'text-leading'Icon placement, 'start' or 'text-leading'.0.1.0
showIconbooleanTrue'true'Whether to show icon.0.1.0
pollSizeChangebooleanTruefalseEnable polling for size changes (may impact performance).0.1.0

AlertEvents

EventParameterDescriptionVersion
closee: MouseEventEmitted when close icon is clicked, callback receives MouseEvent.0.1.0

AlertSlots

SlotParameterDescriptionVersion
defaultDefault content slot.0.1.0
titleTitle slot.0.1.0
iconIcon slot.0.1.0

NumberOrPercentage

ts
export type NumberOrPercentage = number | `${number}%`