![Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility](https://cdn.sanity.io/images/cgdhsj6q/production/97774ea8c88cc8f4bed2766c31994ebc38116948-1664x1366.png?w=400&fit=max&auto=format)
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
vue3-lottie
Advanced tools
[![npm](https://img.shields.io/npm/v/vue3-lottie)](https://www.npmjs.com/package/vue3-lottie) [![Downloads](https://img.shields.io/npm/dt/vue3-lottie)](https://www.npmjs.com/package/vue3-lottie) [![Stars](https://img.shields.io/github/stars/megasanjay/vue
vue3-lottie
was created to help developers add Lottie animations to their Vue 3 applications. In my search for a simple way to add Lottie animations to my Vue application I found a suprising lack of maintained solutions. vue3-lottie
is a vue wrapper around the lottie-player
library with a few additional features.
View the live demos here: https://vue3-lottie.vercel.app/examples.html
If you are using version 1.x or v2.x of vue3-lottie
you should upgrade to version 3.x. You can do this by running the Installation command below. There are some new imports so take a look at the new documentation.
If you are using npm:
npm install vue3-lottie@latest --save
If you are using yarn:
yarn add vue3-lottie@latest
vue3-lottie
over yarn
or npm
. lottie-web
is a dependency of vue3-lottie
and should be automatically installed when you install vue3-lottie
.yarn add vue3-lottie@latest
npm install vue3-lottie@latest --save
The most common use case is to register the component globally.
// main.js
import { createApp } from 'vue'
import Vue3Lottie from 'vue3-lottie'
import 'vue3-lottie/dist/style.css'
createApp(App).use(Vue3Lottie).mount('#app')
Alternatively you can import the component locally.
<template>
<Vue3Lottie :animationData="AstronautJSON" :height="200" :width="200" />
</template>
<script>
import { Vue3Lottie } from 'vue3-lottie'
import 'vue3-lottie/dist/style.css'
const AstronautJSON = require('./astronaut.json')
export default {
components: {
Vue3Lottie,
},
data() {
return {
AstronautJSON,
}
},
}
</script>
vue3-lottie
over yarn
or npm
. lottie-web
is a dependency of vue3-lottie
and should be automatically installed when you install vue3-lottie
.yarn add vue3-lottie@latest
npm install vue3-lottie@latest --save
plugins
at the root of your project.vue3-lottie.client.js
inside the plugins directory.vue3-lottie.client.js
file.import { Vue3Lottie } from 'vue3-lottie'
export default defineNuxtPlugin((nuxtApp) => {
nuxtApp.vueApp.use(Vue3Lottie)
})
app.vue
file.import 'vue3-lottie/dist/style.css'
More detailed explanations are provided in the documentation.
Prop | Type | Default Value | Description |
---|---|---|---|
animationData | Object | {} | The lottie animation data provided as a JSON object |
animationLink | String | '' | A URL link to the Lottie animation data (eg: Lottie Animation URL on lottiefiles.com) |
width | Number or String | "100%" | Width of the lottie animation container (Numbers correspond to pixel values) |
height | Number or String | "100%" | Height of the lottie animation container (Numbers correspond to pixel values) |
speed | Number | "1" | Speed of the lottie animation |
direction | String | "forward" | Animation play direction |
loop | Number or Boolean | true | The number of instances that the lottie animation should run (true is infinite) |
autoPlay | Boolean | true | Start animation on component load |
delay | Number | 0 | Delay the animation play state by some milliseconds |
pauseAnimation | Boolean | false | Prop to pass reactive variables so that you can control animation pause and play |
pauseOnHover | Boolean | false | Whether to pause the animation on hover |
playOnHover | Boolean | false | Whether to play the animation when you hover |
backgroundColor | String | transparent | Background color of the container |
showControls | Boolean | false | Show the lottie-player controls |
A few events are emitted from the component. Look at the Demos for examples.
You can control the animation with the following methods. These methods can be called by assigning a ref
value to the vue3-lottie
component. Look at the Demos for examples.
A big thank you goes to @reslear for adding Typescript support to this library. Go check out his profile and give him a follow!
FAQs
Add Lottie animations to your Vue 3 or Nuxt 3 application.
The npm package vue3-lottie receives a total of 40,350 weekly downloads. As such, vue3-lottie popularity was classified as popular.
We found that vue3-lottie demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.