Gathering detailed insights and metrics for @tafelnl/vue3-lottie
Gathering detailed insights and metrics for @tafelnl/vue3-lottie
Gathering detailed insights and metrics for @tafelnl/vue3-lottie
Gathering detailed insights and metrics for @tafelnl/vue3-lottie
A simple Vue 3 component for using Lottie animations in Vue 3
npm install @tafelnl/vue3-lottie
Typescript
Module System
Min. Node Version
Node Version
NPM Version
Vue (86.6%)
TypeScript (11.81%)
HTML (1.59%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
418 Stars
676 Commits
41 Forks
3 Watchers
23 Branches
13 Contributors
Updated on Jul 09, 2025
Latest Version
3.3.0
Package Id
@tafelnl/vue3-lottie@3.3.0
Unpacked Size
438.96 kB
Size
108.54 kB
File Count
8
NPM Version
8.5.0
Node Version
16.14.2
Published on
Apr 19, 2024
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
Add Lottie animations to your Vue 3 or Nuxt 3 application.
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-web
library with a few additional features.
View the live demos here: https://vue3-lottie.vercel.app
If you are using version 2.x of vue3-lottie
you should upgrade to version 3.x. You can do this by running the Installation and Usage command below. This add better support for Typescript. There is also a change with the dist/style.css
import (it's been removed) so take a look at the new documentation for instructions on how to migrate to this package.
vue3-lottie
over yarn
or npm
. lottie-web
is a dependency of vue3-lottie
and should be automatically installed when you install vue3-lottie
.If you are using npm:
1npm install vue3-lottie@latest --save
If you are using yarn:
1yarn add vue3-lottie@latest
The most common use case is to register the component globally.
1// main.js 2import { createApp } from 'vue' 3import Vue3Lottie from 'vue3-lottie' 4 5createApp(App).use(Vue3Lottie).mount('#app')
If you get an error with TS, try use(Vue3Lottie, { name: "Vue3Lottie" })
To define global components for Volar type-checking you will need to add:
1// components.d.ts 2declare module '@vue/runtime-core' { 3 export interface GlobalComponents { 4 LottieAnimation: typeof import('vue3-lottie')['Vue3Lottie'] 5 } 6} 7export {}
If needed rename component to use:
1app.use(Vue3Lottie, { name: 'LottieAnimation' }) // use in template <LottieAnimation />
name
string (default: 'Vue3Lottie') - set custom component nameAlternatively you can also import the component locally.
1import { Vue3Lottie } from 'vue3-lottie' 2 3export default { 4 components: { 5 Vue3Lottie, 6 }, 7}
You can then use the component in your template
1<template> 2 <Vue3Lottie :animationData="AstronautJSON" :height="200" :width="200" /> 3</template> 4 5<script> 6import { Vue3Lottie } from 'vue3-lottie' 7 8import AstronautJSON from './astronaut.json' 9 10export default { 11 components: { 12 Vue3Lottie, 13 }, 14 data() { 15 return { 16 AstronautJSON, 17 } 18 }, 19} 20</script>
This is still experimental. Will be updated soon.
vue3-lottie
over yarn
or npm
. lottie-web
is a dependency of vue3-lottie
and should be automatically installed when you install vue3-lottie
.If you are using npm:
1npm install vue3-lottie@latest --save
If you are using yarn:
1yarn add vue3-lottie@latest
plugins
at the root of your project.Vue3Lottie.client.ts
inside the plugins directory.Vue3Lottie.client.ts
file.1import { Vue3Lottie } from 'vue3-lottie' 2 3export default defineNuxtPlugin((nuxtApp) => { 4 nuxtApp.vueApp.component('Vue3Lottie') 5})
If you get an error with TS, try component(Vue3Lottie, { name: "Vue3Lottie" })
This should register as a global component that you can call anywhere in your app under the
I would recommend using a <client-only>
parent tag to ensure that the animation only loads in on the client side.
1<client-only> 2 <Vue3Lottie 3 animationLink="https://assets10.lottiefiles.com/packages/lf20_soCRuE.json" 4 :height="200" 5 :width="200" 6 /> 7</client-only>
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 |
noMargin | Boolean | false | Prevent the lottie from auto centering in the container. This gives you better control on placement within your UI |
scale | Number | 1 | Scale the animation (might cause blurriness) |
assetsPath | String | "" | URL to the image asset you need to use in your Lottie animation |
renderer | String | "svg" | Set the renderer |
rendererSettings | Object | {} | Options for if you want to use an existing canvas to draw (can be ignored on most cases) |
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!
watch
functionassetsPath
prop to the componentlodash-es
for klona
and fast-deep-equal
suspense
components
No vulnerabilities found.
No security vulnerabilities found.