Skip to content
  1. Install the player.

    Terminal window
    npm i @rupamotion/player
  2. Put hero.rupaplay (export as Player file in Rupamotion) in public/.

  3. Render the component in a page. The App Router needs no "use client" here: @rupamotion/player/react is already a client module, and src and markup are plain strings a Server Component can pass.

    app/page.tsx
    import { RupaPlayer } from "@rupamotion/player/react";
    export default function Page() {
    return <RupaPlayer src="/hero.rupaplay" markup="auto" />;
    }

That’s it: the animation plays after hydration.

This demo loads a .rupaplay file: it plays once JavaScript runs.

A ref, a hook or a callback prop (onReady, onError) needs a client component, so the file starts with "use client":

app/hero.tsx
"use client";
import { useRef } from "react";
import { RupaPlayer, usePlayerState } from "@rupamotion/player/react";
import type { Player } from "@rupamotion/player";
export function Hero() {
const player = useRef<Player>(null);
const { paused } = usePlayerState(player);
return (
<>
<RupaPlayer ref={player} src="/hero.rupaplay" markup="auto" />
<button onClick={() => (paused ? player.current?.play() : player.current?.pause())}>
{paused ? "Play" : "Pause"}
</button>
</>
);
}

See Control playback and Events.

The text you put inside renders on the server; the motion starts after hydration. Put the .rupaplay file in public/.

"use client";
import { RupaPlayer } from "@rupamotion/player/react";
export default function Hero() {
return <RupaPlayer src="/hero.rupaplay" markup="auto" />;
}

See React for the hooks and server rendering.