Limited offer — lifetime access:$75$60
Rive · HTML

Rive in HTML

Add Rive animated icons to any HTML page via CDN using canvas-based rendering — no build tools or framework required.

1

Include the Rive script

Add the Rive WebGL CDN script tag to your HTML page.

HTML
<script src="https://unpkg.com/@rive-app/webgl@2.9.1"></script>
2

Add a canvas element

Rive renders into a canvas element. Set the width and height to match your icon size.

HTML
<canvas id="rive-canvas" width="150" height="150"></canvas>
3

Load the animation

Initialise Rive with the path to your downloaded .riv file and configure state machines.

JS
const canvas = document.getElementById("rive-canvas");

const r = new rive.Rive({
  src: "your_animation.riv",
  canvas: canvas,
  autoplay: true,
  artboard: "Main",
  stateMachines: ["State Machine 1"], // e.g. "Clicked", "Hover"
  onLoad: () => console.log("Rive loaded")
});
4

Fire state machine inputs

Trigger animations in response to user events by firing state machine inputs.

JS
const inputs = r.stateMachineInputs("State Machine 1");
const trigger = inputs.find((i) => i.name === "Trigger");
trigger?.fire();

// For boolean inputs:
const hovered = inputs.find((i) => i.name === "Hover");
hovered.value = true;

Get your animated icons

Browse icons ready for HTML — free to download.

Browse icons