Transitions
Vue Bootstrap 5 Transition
Transitions are built-in Vue animation feature. It is an alternative to MDBAnimation component because both are using the same CSS classes.
Move the mouse over the squares below to launch the animation.
Basic example
Import MDBTransition from 'mdb-vue-ui-kit' and add inside an element which you want to be animated. Pass the prop name - one of the list attached below - and add to animated element v-if or v-show. On conditional rendering (or display) depends animation. More about Transitions read in Vue official documentation.
<template>
<MDBBtn @click="animation = !animation">Change</MDBBtn>
<MDBTransition name="slide-right">
<MDBIcon v-show="animation" icon="car-side" size="3x"></MDBIcon>
</MDBTransition>
</template>
<script>
import { MDBTransition, MDBIcon, MDBBtn } from 'mdb-vue-ui-kit';
import { ref } from "vue";
export default {
components: {
MDBTransition,
MDBIcon,
MDBBtn
},
setup() {
const animation = ref(false);
return {
animation,
}
}
};
</script>
<script setup lang="ts">
import { MDBTransition, MDBIcon, MDBBtn } from 'mdb-vue-ui-kit';
import { ref } from "vue";
const animation = ref(false);
</script>
On load example
Use prop autoInit to start the animation after loading the page. Refresh your browser to see this effect.
<template>
<MDBTransition name="slide-right" autoInit>
<MDBIcon icon="car-side" size="3x"></MDBIcon>
</MDBTransition>
</template>
<script>
import { MDBTransition, MDBIcon } from 'mdb-vue-ui-kit';
export default {
components: {
MDBTransition,
MDBIcon,
},
};
</script>
<script setup lang="ts">
import { MDBTransition, MDBIcon } from 'mdb-vue-ui-kit';
</script>
Animation list
By default, you have access to the basic & extended animations.
Basic Animations
fade-infade-in-downfade-in-leftfade-in-rightfade-in-upfade-outfade-out-downfade-out-leftfade-out-rightfade-out-upslide-in-downslide-in-leftslide-in-rightslide-in-upslide-out-dDownslide-out-leftslide-out-rightslide-out-upslide-downslide-leftslide-rightslide-upzoom-inzoom-outtadapulse
Extended Animations
drop-indrop-outfly-infly-in-upfly-in-downfly-in-leftfly-in-rightfly-outfly-out-upfly-out-downfly-out-leftfly-out-rightbrowse-inbrowse-outbrowse-out-leftbrowse-out-rightjiggleflashshakeglow
Animations - API
Import
<script>
import { MDBAnimations } from 'mdb-vue-ui-kit';
</script>
Properties
| Name | Type | Default | Description | Example |
|---|---|---|---|---|
name
|
String | '' |
Defines animation |
<MDBTransition :name="slide-right" />
|
autoInit
|
Boolean | false |
Tells if animation should automatically displays after load a page. |
<MDBTransition :name="slide-right" autoInit />
|