lottie-react

React library and hooks for rendering Lottie/After Effects animations

Library
npm
v3.1.2
969 stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
73 /100 Good
Development Activity 80
Maintenance 68
Community 44
Maturity 60
Momentum 40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
72 /100 Good
Architecture 72
Code Quality 70
Innovation 68
Learning Curve 78

lottie-react wraps Airbnb’s lottie-web player in a React-friendly API, exposing both a drop-in <Lottie /> component and a useLottie()/useLottieInteractivity() hook pair for rendering complex After Effects animations exported as Lottie JSON in real time. It handles the animation lifecycle (mount, play, loop, destroy) as React state and refs so consumers don’t have to manage the underlying lottie-web instance imperatively.

The interactivity hook adds scroll- and cursor-driven playback control on top of the base player, making it a common choice for marketing sites and product UIs that want polished, designer-authored motion graphics without hand-rolling CSS or canvas animation code.

What You Get

  • A <Lottie /> component for dropping a Lottie JSON animation into a React tree with minimal setup
  • A useLottie() hook returning a renderable View plus imperative playback controls (play, pause, stop, setSpeed, segments)
  • A useLottieInteractivity() hook for scroll-linked and cursor-linked animation playback
  • Full TypeScript typings for animation options, refs, and event callbacks (onComplete, onLoopComplete, onDOMLoaded, etc.)
  • Direct access to the underlying lottie-web AnimationItem via lottieRef for advanced imperative control

Common Use Cases

  • Rendering designer-exported After Effects/Lottie animations (loaders, micro-interactions, hero illustrations) in a React marketing site
  • Building scroll-driven storytelling sections where animation progress is tied to scroll position via useLottieInteractivity
  • Adding interactive hover/cursor-reactive animations to buttons or cards using cursor-based interactivity mode
  • Replacing GIF or video loaders with lightweight, resolution-independent vector animations in a React app

Under The Hood

Architecture - useLottie (src/hooks/useLottie.tsx) owns the animation lifecycle: it creates a lottie-web AnimationItem in a useEffect keyed on the container ref and animation data, attaches/detaches the various on* event listeners passed as props, and exposes both a View (a plain div ref target) and an imperative ref object mirroring lottie-web’s own API (play, pause, setSpeed, playSegments, etc.); useLottieInteractivity wraps a useLottie instance and adds scroll or cursor position tracking that maps to goToAndStop/segment playback calls.

Tech Stack - A thin TypeScript wrapper around lottie-web (the only runtime dependency) with React as a peer dependency; built with a standard TS build pipeline and tested via src/__tests__ specs (Lottie.test.tsx, useLottie.test.tsx, useLottieInteractivity.test.tsx) using React Testing Library-style component/hook tests with bundled animation JSON fixtures under __tests__/assets.

Code Quality - The hook-based design keeps state management idiomatic to React (refs, effects, state) rather than reaching for imperative DOM manipulation outside React’s lifecycle, and the presence of dedicated tests per hook/component is a good sign; a // TODO in useLottie.tsx around manually excluding non-DOM props from the spread rest object is an acknowledged rough edge rather than a hidden one.

API Design - Offering both a ready-made <Lottie /> component and lower-level hooks gives consumers a choice between minimal boilerplate and full control, and mirroring lottie-web’s own method names (play, setSpeed, goToAndPlay) on the returned ref keeps the API familiar to anyone who has used lottie-web directly, at the cost of the wrapper types needing to track a moving upstream API surface.

Used by 12 apps in this directory

TypeScript
82%
Other

AFFiNE

Collaboration · Note Taking · Productivity

73,040

Write, draw, and plan in one infinite canvas — the open-source alternative to Notion and Miro that keeps your data yours.

View details
91
Repo Health
87
Technical
67
Dependency
Built with
TypeScript 82%
Rust 11%
Updated 6 days ago
TypeScript
96%
Other

Amplication

AI Code Assistants · Automation · Developer Tools

16,015

Create production-ready backend services with your organization's standards baked in — generating NestJS, Prisma, and GraphQL code that you own and control.

View details
58
Repo Health
84
Technical
60
Dependency
Built with
TypeScript 96%
Updated 3 months ago
TypeScript
91%
Apache 2.0

Helicone

AI Development · Analytics · Monitoring

6,182

An open-source AI gateway and LLM observability platform that routes requests to 100+ models while logging cost, latency, and full traces for every call.

View details
70
Repo Health
81
Technical
65
Dependency
Built with
TypeScript 91%
Updated 2 weeks ago
TypeScript
71%
Other

highlight.io

Analytics · Developer Tools · Monitoring

9,378

Open-source full-stack monitoring that unifies session replay, error tracking, logging, and distributed tracing so you can stop context-switching between tools.

View details
67
Repo Health
78
Technical
65
Dependency
Built with
TypeScript 71%
Go 16%
Updated 1 months ago
TypeScript
100%
Apache 2.0

ILLA Builder

Design Tools · Developer Tools · Low Code Platforms

12,327

Open-source low-code platform for building internal tools with drag-and-drop UI, reactive data bindings, and real-time collaboration.

View details
56
Repo Health
71
Technical
63
Dependency
Built with
TypeScript 100%
Updated 4 months ago
TypeScript
96%
AGPL 3.0

Midday

Invoicing Finance · Productivity

15,042

All-in-one AI-powered business operations platform for freelancers and solo entrepreneurs to manage invoicing, time tracking, banking, and financial intelligence.

View details
53
Repo Health
78
Technical
67
Dependency
Built with
TypeScript 96%
Updated 3 months ago
TypeScript
88%
AGPL 3.0

OpenPanel

Analytics

7,057

Open-source Mixpanel alternative with session replay, MCP integration, and privacy-first product analytics you fully control.

View details
74
Repo Health
74
Technical
65
Dependency
Built with
TypeScript 88%
MDX 10%
Updated 1 weeks ago
JavaScript
64%
AGPL 3.0

overleaf

Collaboration · Productivity

18,188

Open-source, real-time collaborative LaTeX editor with sandboxed compilation and full TeXLive support for self-hosted academic and research teams.

View details
87
Repo Health
80
Technical
62
Dependency
Built with
JavaScript 64%
TypeScript 30%
Updated 2 weeks ago
TypeScript
96%
Apache 2.0

Pezzo

AI Development · Monitoring

3,275

Open-source LLMOps platform for prompt management, AI observability, intelligent caching, and real-time cost tracking across LLM providers.

View details
61
Repo Health
75
Technical
66
Dependency
Built with
TypeScript 96%
Updated 1 months ago

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers