lottie-react
Reference

Lottie, LottieSvg and LottieLight

The three components, and every prop of their own.

import { Lottie } from "lottie-react";export function FirstAnimation() {  return <Lottie src="/anim.json" autoplay loop />;}

Props

PropTypeBehaviour
srcstring | objectThe animation: a path or URL to fetch, or the parsed file. Load-time; compared by content.
renderer"svg" | "canvas" | "html"Which renderer draws it. Load-time. Default svg.
rendererSettingsper rendererSettings typed to match the chosen renderer. Load-time.
autoplaybooleanStart as soon as the animation is ready. Load-time. Default false; holds under reduced motion.
segment[number, number]The frame range to play. Load-time.
assetsPathstringWhere the animation's images live when not beside it. Load-time.
loopboolean | numberfalse none, true forever, or a number of repeats after the first play (loop={3} plays four times). Reactive.
speednumberPlayback rate, 1 is the file's own. Reactive.
direction"forward" | "reverse"Which way it plays. Reactive.
astag nameThe element to render. Default div; illegal tags are compile errors.
childrenReactNodePresent means you place the parts; absent means the component does.
lottieRefRef<LottieHandle>The commands, handed back; the values reach you through subscriptions. See Refs and handles.
subscriptionshandlers objectCalled as the animation reports events.
debugbooleanTraces the load lifecycle to the console. Default off.

Plus any standard HTML attribute: className, style, id, data-*, aria-* and DOM events all land on the rendered element, and ref names that element.

LottieSvg and LottieLight

The same surface on a smaller engine, svg only; the types refuse the other renderers. LottieSvg keeps the expression engine; LottieLight drops it too and contains no eval. Renderers and the smaller builds has the numbers.

On this page