Alert API

This page provides an overview of the Alert component API, detailing its props, emits, slots, and exposed methods/states.

Props

The Alert component accepts the following props:

PropDefaultTypeDescription
modelValuefalsebooleanControls the visibility of the alert.
type"success"Type or undefinedType of the alert message.
position"top"PositionShort or undefinedPosition of the alert on the screen.
size"2xl"Size or undefinedSize of the alert.
title""stringThe title of the alert.
subtitle""stringThe subtitle of the alert.
toTeleport"body"stringSelector for teleporting the alert to a specific container.
class""StyleClassCustom CSS class for the alert.
styleundefinedCSSPropertiesCustom inline styles for the alert.
displayTime0string or number or undefinedDuration for which the alert is displayed (in milliseconds).
notAnimatefalsebooleanDisables animations for the alert.
closeButtonfalsebooleanEnables the close button for the alert.

Emits

The Alert component emits the following events:

EmitPayloadDescription
update:modelValuebooleanEmitted when the modelValue prop is updated.

Slots

The Alert component provides the following slots:

SlotPayloadDescription
defaultVNode[]Slot for adding custom content inside the alert.

Expose

The Alert component exposes the following methods and states via ref:

ExposeTypeDescription
isVisiblebooleanCurrent visibility state of the alert.
typeAlertProps["type"]Current type of the alert.
titleAlertProps["title"]Current title of the alert.
subtitleAlertProps["subtitle"]Current subtitle of the alert.
displayTimenumberCurrent display duration of the alert (in milliseconds).
isCloseButtonAlertProps["closeButton"]Indicates if the close button is enabled.
positionAlertProps["position"]Current position of the alert.
classesStyleRecord<"body" | "icon" | "title" | "subtitle" | "button" | "buttonIcon", StyleClass>CSS classes for various parts of the alert.
sizeStyleClassCurrent size of the alert.
classBaseStyleClassBase CSS class for the alert.
close() => voidCloses the alert.

Types

Type

The type prop specifies the visual style and intent of the alert. It accepts the following values:

ValueDescription
"success"Represents a successful operation. Styled with green colors.
"warning"Represents a warning message. Styled with yellow or amber colors to indicate caution.
"info"Represents informational content. Styled with blue colors to provide neutral or helpful details.
"error"Represents an error or critical issue. Styled with red colors to signify a problem.
"neutral"Represents a neutral message. Styled with gray or neutral tones for general-purpose alerts.

Size

The size prop accepts the following values to define the width of the dialog:

xs, sm, md, lg, xl, 2xl (default), 3xl, 4xl, 5xl, 6xl, 7xl

PositionShort

The PositionShort type defines the relative position of the alert on the screen:

ValueDescription
"center"Centers the alert on the screen.
"top"Positions the alert at the top of the screen.
"bottom"Positions the alert at the bottom of the screen.
"left"Positions the alert on the left side of the screen.
"right"Positions the alert on the right side of the screen.
"bottom-left"Positions the alert at the bottom-left corner.
"top-left"Positions the alert at the top-left corner.
"bottom-right"Positions the alert at the bottom-right corner.
"top-right"Positions the alert at the top-right corner.
© 2025 FishtVue by Egoka