Alert
VAlert displays a message in the flow of the page, with an optional title, actions and close button. For temporary notifications, use toast().
Usage
Scheduled maintenance
Examples
Variants
variant selects soft, a tinted surface, or outline, the page surface inside a tinted border.
Tones
tone sets the semantic colour and the default icon.
Icon
icon replaces the tone’s icon. hideIcon removes it. The icon is decorative: the text must carry the meaning.
Actions
The actions slot places buttons or links under the message.
Payment failed
Closable
closable adds a close button that sets open to false and emits close. Bind v-model:open to show the alert again.
Scheduled maintenance
Live
By default, the alert is read with the rest of the page. live announces it: role="status", or role="alert" for the danger tone. Use it for alerts that appear after an action.
API
Props
| Prop | Type | Default |
|---|---|---|
variant | AlertVariant'soft' | 'outline' | 'soft' |
| Visual style. | ||
tone | AlertTone'neutral' | 'accent' | 'danger' | 'success' | 'warning' | 'accent' |
| Colour tone. Also selects the default icon. | ||
title | string | none |
Text above the message. Replaced by the title slot. | ||
icon | IconSource | none |
| Icon replacing the tone’s icon. | ||
hideIcon | boolean | false |
| Hides the icon. | ||
closable | boolean | false |
| Shows a close button. | ||
closeLabel | string | none |
| Accessible close button name. Defaults to the dictionary. | ||
live | boolean | false |
Announces the alert with role="status", or role="alert" for the danger tone. | ||
v-model:open | boolean | true |
Whether the alert is shown. The close button sets it to false. | ||
Events
| Event | Type |
|---|---|
close | [] |
The close button was activated. open is already false. | |
Slots
| Slot | Type |
|---|---|
default | {} |
| Message. | |
title | {} |
| Custom title content. | |
actions | {} |
| Buttons or links under the message. | |
Types
Types used in the API tables. Import exported types from vectis-ui.
export interface BuiltinIcon {
name: string
paths: readonly [string] | readonly [string, string]
}export type IconRender =
| { path: string; viewBox?: string }
| { component: Component; props?: Record<string, unknown> }
| { src: string }
| { text: string; class?: string }
| { class: string }export type IconSource = string | BuiltinIcon | IconRender