Lottie Max

Integration · Web frameworks

How to use Lottie in Next.js

Lottie players touch browser APIs, so in Next.js they must run on the client. Use a Client Component, or a dynamic import with SSR disabled.

Design and animate in the Lottie Max studio, export .json or .lottie, then drop it into your app
Design and animate in the Lottie Max studio, export .json or .lottie, then drop it into your app

Install

Add the player package lottie-react.

Terminal
npm install lottie-react

Add the animation

  1. 1 Export your animation as .json from Lottie Max.
  2. 2 Install lottie-react.
  3. 3 Add "use client" to the component that renders the animation (App Router).
  4. 4 Import the JSON and render <Lottie animationData={...} />.
app/Hero.tsx (Client Component)
"use client";
import Lottie from "lottie-react";
import animation from "@/public/animation.json";

export function Hero() {
  return <Lottie animationData={animation} loop />;
}
Dynamic import (no SSR)
import dynamic from "next/dynamic";

const Lottie = dynamic(() => import("lottie-react"), { ssr: false });

Tips

Need an animation first?

Design and export one in the studio — free, in your browser.

Open the studio

FAQ

Is Lottie Max free to use with Next.js?
Yes. Lottie Max is free and runs in your browser — make the animation, export it, and drop it into your project.
What file should I export for Next.js?
A Lottie .json works everywhere. For a smaller file, export .lottie (dotLottie, ~3× smaller) where the player supports it.
Where do I get the animation file?
Create it in the Lottie Max studio, then use Export to download .json / .lottie or copy a ready-to-paste embed snippet.

Using a different stack?