lottie-react

React library and hooks for rendering Lottie/After Effects animations

Library
npm
v3.1.0
964stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
75/100Good
Development Activity88
Maintenance68
Community44
Maturity60
Momentum40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
72/100Good
Architecture72
Code Quality70
Innovation68
Learning Curve78

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
88%
Other

AFFiNE

Productivity · Project Management · Note Taking

71,668

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
68
Dependency
Built with
TypeScript88%
Updated today
TypeScript
96%
Other

Amplication

Developer Tools · AI Code Assistants · Automation

16,010

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
61
Repo Health
84
Technical
60
Dependency
Built with
TypeScript96%
Updated 1 months ago
TypeScript
91%
Apache 2.0

Helicone

Monitoring · AI Development · Analytics

6,083

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
62
Repo Health
81
Technical
66
Dependency
Built with
TypeScript91%
Updated 3 days ago
TypeScript
71%
Other

highlight.io

Developer Tools · Analytics · Monitoring

9,367

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
69
Repo Health
78
Technical
66
Dependency
Built with
TypeScript71%
Go16%
Updated yesterday
TypeScript
100%
Apache 2.0

ILLA Builder

Developer Tools · Low Code Platforms · No Code Platforms

12,311

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

View details
58
Repo Health
71
Technical
65
Dependency
Built with
TypeScript100%
Updated 2 months ago
TypeScript
96%
AGPL 3.0

Midday

Invoicing Finance · Productivity

14,770

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

View details
56
Repo Health
78
Technical
72
Dependency
Built with
TypeScript96%
Updated 2 months ago
TypeScript
87%
AGPL 3.0

OpenPanel

Analytics

6,698

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

View details
75
Repo Health
74
Technical
69
Dependency
Built with
TypeScript87%
MDX11%
Updated today
JavaScript
63%
AGPL 3.0

overleaf

Collaboration · Productivity

18,035

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

View details
84
Repo Health
80
Technical
67
Dependency
Built with
JavaScript63%
TypeScript29%
Updated 1 months ago
TypeScript
96%
Apache 2.0

Pezzo

AI Development · Monitoring

3,265

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

View details
59
Repo Health
75
Technical
67
Dependency
Built with
TypeScript96%
Updated 3 weeks 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

Search