React interactive animation with the ExodeUI SDK
For React interactive animation that a designer builds and your code controls, install the exodeui package and render a .exode file with the ExodeUICanvas component. The useExodeUI hook sets state machine inputs and fires triggers from your React state, so a button press or API result changes what the animation does. If you only need simple enter, exit and layout transitions written in code, a code library such as Motion (Framer Motion) is the simpler choice.
React SDK · Updated November 2026
npm install exodeuiGetting Started
The React SDK provides full integration with React, including hooks, state management, and physics engine access.
Vite Setup
If using Vite, configure the Exode Vite plugin to load .exode files:
// vite.config.ts
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import { exodePlugin } from 'exodeui/vite-plugin'
export default defineConfig({
plugins: [react(), exodePlugin()],
})Basic Usage
import { ExodeUICanvas } from 'exodeui';
function App() {
return (
<div style={{ width: 800, height: 600 }}>
<ExodeUICanvas
src="/https/www.exodeui.com/animations/my-scene.json"
autoPlay={true}
fit="Contain"
alignment="Center"
/>
</div>
);
}State Variables & Controls
Drive state variables from React using the useExodeUI hook:
import { useExodeUI, ExodeUICanvas } from 'exodeui';
function Controls() {
const { setEngine, setInputBool, fireTrigger, getInputValue } = useExodeUI();
return (
<>
<ExodeUICanvas src="/https/www.exodeui.com/player_controller.json" onReady={setEngine} />
<button onClick={() => setInputBool('IsRunning', true)}>Run</button>
<button onClick={() => fireTrigger('Jump')}>Jump</button>
<button onClick={() => console.log(getInputValue('MyRandomNumber'))}>
Log Value
</button>
</>
);
}Data Visualization & Graphs (v7.0.0)
Render Catmull-Rom line graphs, bar charts, and pie charts with real-time updates directly from your React state:
import { useExodeUI, ExodeUICanvas } from 'exodeui';
function RealtimeDashboard() {
const { setEngine, updateGraphData, updateBarChartData, updatePieChartData } = useExodeUI();
const handleUpdate = () => {
// 1. Update LineGraph data points
updateGraphData('SalesGraph', [12, 45, 28, 80, 65, 95]);
// 2. Update BarChart series and categories
updateBarChartData('RevenueBarChart', [[100, 200, 300]], ['Q1', 'Q2', 'Q3']);
// 3. Update PieChart slice values
updatePieChartData('MarketSharePie', [45, 30, 25]);
};
return (
<div>
<ExodeUICanvas src="/https/www.exodeui.com/dashboard.json" onReady={setEngine} />
<button onClick={handleUpdate}>Stream Live Data</button>
</div>
);
}useExodeUI Hook API
| Method | Signature | Description |
|---|---|---|
| setEngine | (engine: ExodeUIEngine) => void | Connects the hook to ExodeUICanvas onReady |
| setInputBool | (name: string, value: boolean) => void | Sets a boolean state machine input |
| setInputNumber | (name: string, value: number) => void | Sets a numeric input value |
| setInputText | (name: string, value: string) => void | Sets a text/string input value |
| setInputNumberArray | (name: string, value: number[]) => void | Passes an array of numbers to data-bound components |
| updateGraphData | (nameOrId: string, data: number[] | number[][], categories?: string[]) => void | Polymorphic real-time data updater for LineGraph, BarChart, or PieChart |
| updateBarChartData | (nameOrId: string, datasets: number[][], categories?: string[]) => void | Updates multi-series datasets and category labels on bar charts |
| updatePieChartData | (nameOrId: string, slices: (number | object)[]) => void | Updates slices and proportions on pie charts |
| setDropdownOptions | (nameOrId: string, options: string[]) => void | Dynamically populates dropdown / select options |
| fireTrigger | (name: string) => void | Fires a momentary trigger input or entry transition |
| getInputValue | (nameOrId: string) => any | Reads the runtime value of any state variable or engine-evaluated property |
SEO & Metadata
The ExodeSEO component manages meta tags and accessible HTML overlay:
import { ExodeUICanvas, ExodeSEO } from 'exodeui';
function MyPage({ artboard }) {
return (
<>
<ExodeSEO artboard={artboard} />
<ExodeUICanvas artboard={artboard} />
</>
);
}ExodeUICanvas Props
| Prop | Type | Default | Description |
|---|---|---|---|
| src | string | — | URL to the animation JSON file |
| artboard | object | — | Direct JSON data object |
| fit | 'Contain' | 'Cover' | 'Fill' | 'Contain' | Scaling strategy |
| alignment | 'Center' | 'TopLeft' ... | 'Center' | Canvas alignment |
| autoPlay | boolean | true | Auto-start the animation loop |
| onReady | (engine) => void | — | Callback when engine is initialized |
| onTrigger | (name, anim) => void | — | Listener for state machine triggers |
| onInputUpdate | (name, value) => void | — | Listener for input updates |
Motion Architecture Concepts
Deep dive into foundational motion concepts, spring physics, and timeline sequencing:
Production React Recipes
Copyable, production-ready motion recipes for common React UI patterns:
React interactive animation: common questions
What is the npm package name?
exodeui. Install it with npm install exodeui. It exports ExodeUICanvas, the useExodeUI hook and a Vite plugin for importing .exode files.
How do I change the animation from React state?
Pass setEngine from useExodeUI to the onReady prop of ExodeUICanvas. Then call setInputBool, setInputNumber or setInputText with the input name from your file, and the state machine reacts on the next frame.
Is this a replacement for Framer Motion?
Not for everything. Motion is a good fit for animating your own DOM elements in code. ExodeUI fits when the animation is designed visually, has several states and should run the same way in other frameworks too.
Does it render to the DOM?
No. ExodeUICanvas draws on a canvas element. Keep text that must be selectable or read by search engines in normal HTML next to it.
Can an AI coding tool build the animation for me?
Yes. ExodeUI has an MCP server, so Claude Code, Cursor and other AI coding tools can create and edit .exode files from plain-language prompts. You then load the file with this runtime like any other.
What does ExodeUI cost?
The editor, CLI and MCP server need ExodeUI Professional: $6.30 a month billed yearly, or $8 month to month. New accounts get a trial. The runtime package installs from the public registry.