You may set and load animations programmatically as well.
React.js / Next.js
Nuxt.js / Vue.js
Update the array of plugins in nuxt.config.js file in your root.
Create a plugin folder in your root if it doesnt exist already, add a file named e. g. lottie-player.js with the following content:
The component can now be used in your pages or components template tag like below – without any imports necessary.
This started as a fork of @dotlottie/player-component, mainly made to address issues with render settings and aspect ratio. Since then we've added some functionalies here and tweaked some configurations there, and now this is the most versatile and effective Lottie Web Component package out there – in our humble opinion. The component is SSR compatible, and it weighs a fraction of what it did when we started out.
Add the element dotlottie-player to you code and point it to a Lottie file of your choice.