The v-alert component is used to convey important information to the user through the use of contextual types, icons, and colors.


An alert is a v-sheetthat specializes in getting the user’s attention. While similar to v-bannerin functionality, v-alert is typically inline with content and used multiple times throughout an application.


v-alertPrimary Component
v-alert-titleSub-component used to display the v-alert title. Wraps the #title slot


The recommended placement of elements inside of v-alert is:

  • Place a v-icon on the far left
  • Place v-alert-title to the right of the contextual icon
  • Place textual content below the title
  • Place closing actions to the far right

Element / AreaDescription
1. ContainerThe Alert container holds all v-alert components
2. IconAn icon that correlates to the contextual state of the alert; success, info, warning, error
3. TitleA heading with increased font-size
4. TextA content area for displaying text and other inline elements
5. Close Icon (optional)Used to hide the v-alert component


The v-alert component is a callout element designed to attact the attention of a user. Unlike v-banner, the v-alert component is intended to be used and re-used throughout your application. An alert’s color is derived from its type property which corresponds to your application’s contextual theme colorsand iconfont aliases.


In addition to the standard v-sheetproperties such as elevation, dimension, and border-radius, the v-alert component supports v-model, variants, and density.


The v-alert component supports simple content using the title and text props. This approach is best for strings that do not need custom styling.

The following code snippet is an example of a basic v-alert component only containing text:

<v-alert text="Lorem ipsum dolor sit amet consectetur adipisicing elit. Commodi, ratione debitis quis est labore voluptatibus..."></v-alert>

Adding a title is as easy as defining its value. The next example adds a string title to accompany the content text:

Notice how the alert does not have a color or icon. This is defined using the type property.


Alerts have 4 contextual states: success, info, warning, and error. Each state has a default color and icon associated with it. When a type is not provided, the v-alert component defaults to a greyish background.

With a basic alert rendered, add your choice of contextual type. The following example puts the v-alert component in a success state:

Type reference
TypeColorIcon aliasIcon

Color and icon

The type property acts as a shorthand for a color and icon combination, you can use both props individually to achieve the same effect. The following example produces the same result as using type=“success” by defining a custom color and using the icon lookup table to get the globally defined success icon:

  title="Alert title"
  text="Lorem ipsum dolor sit amet consectetur adipisicing elit. Commodi, ratione debitis quis est labore voluptatibus..."


The v-alert component has the ability to reduce its height in intervals using the density prop. This is useful when you need to reduce the vertical space a component needs. The following example reduces the vertical space by using density=“compact”:

The density prop supports 3 levels of component height; default, comfortable, and compact.


The v-alert has 6 style variants, elevated, flat, tonal, outlined, text, and plain. By default, the v-alert component is flat; which means that it has a solid background and no box-shadow (elevation). The following example modifies the overall styling of the alert with a custom variant:


The closable prop adds a v-iconon the far right, after the main content. This control hides the v-alert when clicked, setting it’s internal model to false. Manually control the visibility of the alert by binding v-model or using model-value. The following example uses a dynamic model that shows and hides the v-alert component:

The close icon automatically applies a default aria-label and is configurable by using the close-label prop or changing close value in your locale.

Additional Examples

The following is a collection of v-alert examples that demonstrate how different the properties work in an application.

Colored border

The colored-border prop removes the alert background in order to accent the border prop. If a type is set, it will use the type’s default color. If no color or type is set, the color will default to the inverted color of the applied theme (black for light and white/gray for dark).


The icon prop allows you to add an icon to the beginning of the alert component. If a type is provided, this will override the default type icon. Additionally, setting the icon prop to false will remove the icon altogether.


The outlined prop inverts the style of an alert, inheriting the currently applied color, applying it to the text and border, and making its background transparent.


By default, v-alert components are assigned the WAI-ARIArole of alertwhich denotes that the alert "is a live region with important and usually time-sensitive information." When using the closable prop, the close icon will receive a corresponding aria-label. This value can be modified by changing either the close-label prop or globally through customizing the Internationalization’s default value for the close property.

Ready for more?

Continue your learning with related content selected by the Team or move between pages by using the navigation links below.
Edit this page onGitHub