Gathering detailed insights and metrics for react-lottie-hook
Gathering detailed insights and metrics for react-lottie-hook
Gathering detailed insights and metrics for react-lottie-hook
Gathering detailed insights and metrics for react-lottie-hook
lottie-react
Lottie for React
lottie-light-react
Lottie for React (lottie light)
@novemberfiveco/lottie-react-light
Lottie (light) for React
@soulbytestudio/lottie-react-hook
O esquema de animações com o hook useLottieAnimations foi pensado para ter controle total das animações, frame-by-frame.
npm install react-lottie-hook
Typescript
Module System
Min. Node Version
Node Version
NPM Version
68.3
Supply Chain
93.1
Quality
75.7
Maintenance
100
Vulnerability
100
License
TypeScript (92.52%)
JavaScript (5.55%)
CSS (1.93%)
Total Downloads
310,917
Last Day
44
Last Week
631
Last Month
4,583
Last Year
37,612
5 Stars
62 Commits
1 Forks
1 Watchers
3 Branches
4 Contributors
Updated on Jun 23, 2022
Minified
Minified + Gzipped
Latest Version
0.5.0
Package Id
react-lottie-hook@0.5.0
Unpacked Size
144.63 kB
Size
26.88 kB
File Count
8
NPM Version
6.14.15
Node Version
14.17.6
Cumulative downloads
Total Downloads
Last Day
-94.7%
44
Compared to previous day
Last Week
-73.2%
631
Compared to previous week
Last Month
172.5%
4,583
Compared to previous month
Last Year
-41.5%
37,612
Compared to previous year
2
40
Lottie react hook with runtime animation controls.
Lottie is a library for the Web, Android and iOS that parses Adobe After Effects animations through a plugin called bodymovin and exported as JSON; rendering natively on each platform.
Add it with your prefered package manager:
yarn add react-lottie-hook
npm i react-lottie-hook
This library main exports a useLottie
hook and supplies also a standard Lottie
component but you are not required to use the latter.
The useLottie
hook requires a configuration object of type LottieConfig
to be supplied to it and in return you will get an array with a ref to the animation container, state of the animation and the control actions, respectively.
1import React from "react"; 2import { useLottie, Lottie } from "react-lottie-hook"; 3import animationData from "./animation.json"; 4 5const App = () => { 6 const [lottieRef, { isPaused, isStopped }, controls] = useLottie({ 7 renderer: "svg", 8 rendererSettings: { 9 preserveAspectRatio: "xMidYMid slice", 10 progressiveLoad: false, 11 }, 12 animationData, 13 }); 14 15 return <Lottie lottieRef={ref} width={400} height={400} />; 16};
The exported Lottie
component has a type of LottieProps
and the minimum props it requires is a lottieRef
from the useLottie
hook.
Lottie Component props:
props | type | default |
---|---|---|
lottieRef: | React.MutableRefObject<HTMLElement | null> | |
width? | number | 200px |
height? | number | 200px |
style? | object | |
title? | string | |
className? | string | |
ariaRole? | string | |
ariaLabel? | string | |
onKeyDown? | (e: React.KeyboardEvent) => void | |
onClick? | (e: React.MouseEvent<HTMLElement, MouseEvent>) |
Among the options you can pass useLottie
is an eventListeners
object as follows:
1const eventListeners: EventLisener = { 2 /** triggered only if loop is set to true */ 3 loopCompleted: (data) => { console.log('Animation Loop Completed'); }, 4 /** triggered when animation is destroyed */ 5 destroy: : (data) => { console.log('Animation Destroyed'); }, 6 /** triggered when loop is set to false */ 7 complete: (data) => { console.log('Animation Complete'); }, 8}; 9 10const [lottieRef, { isPaused, isStopped }, controls] = useLottie({ 11 renderer: "svg", 12 loop: false, // default true 13 rendererSettings: { 14 preserveAspectRatio: "xMidYMid slice", 15 progressiveLoad: false, 16 }, 17 animationData, 18 eventListeners, 19}); 20
Noam Gabriel Jacobson |
Alex Billingsley |
Arno (H) Welgemoed |
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
Found 1/30 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
license file not detected
Details
Reason
project is not fuzzed
Details
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
56 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More