Vue Alerts

Vue Bootstrap 5 Alerts component

Responsive Alerts built with the latest Bootstrap 5 and Vue 3. Alerts provide contextual feedback messages for typical user actions with a handful of responsible and flexible alert boxes.

Provide contextual feedback messages for typical user actions with the handful of available and flexible alert messages.

Note: Read the API tab to find all available options and advanced customization


Basic examples

Click the buttons to launch the alerts.


Static examples



Additional Content


Dismissing

Using the Vue alert component, it’s possible to dismiss any alert inline. Here’s how:

  • Add a dismiss property, which adds close button and extra padding to the right of the alert which positions the close button.
  • Click on the close button to dismiss the alert.

You can see this in action with a live demo:


Show

You can manually show alert using show() method on the alert component ref.


Hide

You can manually hide alert using hide() method on alert component ref.


Placement

You can set the position of every alert using the position property.

Select horizontal / vertical alignment

Current position: top-right

Container

You can display an alert anywhere. Just put it in your target element and fill the data-mdb-container attribute with id or class of parent.


Offset

You can set offset of your alert using a offset property.


Stacking

You can turn on stacking your alerts using the stacking property.


Stacking - Container

You can also stack alerts inside the container

Vue Alerts - API


Import


        <script>
          import {
            MDBAlert
          } from 'mdb-vue-ui-kit';
        </script>
      

Properties

Name Type Default Description
tag String 'div' Defines tag of the MDBAlert element
position String 'top-right' Sets a position for the alert. Any combination of 'vertical-horizontal' position: 'top|bottom-left|center|right'
delay Number 5000 Sets the length of animation delay
autohide Boolean true Alerts will hide automatically or not
width String 'unset' Sets width of alert
stacking Boolean true Enables stacking alerts
offset String '10 Changes alert offset
container String '' Defines container selector
appendToBody Boolean false Appends element to the end of the body
color String null Allows to set the color of an alert - primary | secondary | secondary | danger | warning | info | light | dark
dismiss Boolean false Makes alert dismissible with close button
animation Boolean true Allows to turn on or off the showing and hiding alert animation
static Boolean false Makes alert static (open by default)
hidden Boolean false Makes static alert hidden
id String 'MDBAlert-generated id' Allows to add custom id to alert element
v-model String '' Returns current picked time

Methods

Name Description Example
show Manually shows an alert alertRef.show()
hide Manually hides an alert alertRef.hide()

            <MDBTimepicker v-model="alert1" ref="alertRef" />
            <MDBBtn @click.stop="$refs.alertRef.show()" color="primary">Show</MDBBtn>
          

Events

Name Description
show This event fires immediately when the show method is called or `v-model` is set to true
shown This event fires immediately when the Alert is shown
hide This event fires immediately when the hide method is called or `v-model` is set to false
hidden This event fires immediately when the Alert is hidden

            <MDBTimepicker v-model="picker1" @close="doSomething" />