
Rive Interactive
Wire Rive vector animations into React with state machines and ViewModels for interactive UI without hand-rolling canvas code.
Overview
Rive Interactive is an agent skill for the Build phase that teaches solo builders how to integrate Rive `.riv` animations into React using `rive-react`, state machines, and ViewModels.
Install
npx skills add https://github.com/freshtechbro/claudedesignskills --skill rive-interactiveWhat is this skill?
- Starter templates for `rive-react` with `npm install rive-react` quick start
- Basic `<Rive>` embed plus state-machine-driven hover inputs on a button `.riv`
- ViewModel pattern: `useViewModel`, `useViewModelInstance`, and string property binding for live dashboard titles
- Copy-paste JSX for mouse enter/leave driving boolean state-machine inputs
Adoption & trust: 752 installs on skills.sh; 227 GitHub stars; 2/3 security scanners passed (skills.sh audits).
What problem does it solve?
You have Rive art files but no clear React pattern for state machines, hover inputs, or ViewModel-bound copy on the page.
Who is it for?
Indie SaaS or app builders adding branded micro-interactions, onboarding flows, or dashboard chrome authored in Rive.
Skip if: Teams that only need static SVG/CSS motion, do not use React, or have not exported `.riv` assets from Rive Editor yet.
When should I use this skill?
Adding or refactoring Rive + React integration, state-machine inputs, or ViewModel-bound UI text.
What do I get? / Deliverables
After using the skill, your agent can scaffold working `rive-react` components with interactive state-machine inputs and ViewModel property updates ready to drop into your UI.
- Rive-backed React components
- State-machine input wiring
- ViewModel-bound dynamic properties
Recommended Skills
Journey fit
Interactive motion and UI polish belong in the build phase when you are implementing the product surface, not during distribution or ops. All examples target React components, hooks (`useRive`, `useStateMachineInput`, ViewModel bindings), and front-end event wiring.
How it compares
Use instead of guessing `rive-react` hook APIs from scattered docs when you need interactive bindings, not generic CSS animation snippets.
Common Questions / FAQ
Who is rive-interactive for?
Solo and indie developers shipping React or React Native–adjacent web UIs who want designer-built Rive animations with real interactivity.
When should I use rive-interactive?
During Build (frontend) when wiring `.riv` files, state machines for hover/click, or ViewModel strings into dashboard or marketing components.
Is rive-interactive safe to install?
Review the Security Audits panel on this Prism page and the upstream repo before enabling the skill; the snippets themselves are standard npm/React integration patterns.
SKILL.md
READMESKILL.md - Rive Interactive
# Rive Interactive - Assets Starter templates and examples for Rive + React integration. ## Quick Start ```bash npm install rive-react ``` ## Basic Usage ```jsx import Rive from 'rive-react'; <Rive src="animation.riv" stateMachines="State Machine 1" style={{ width: '400px', height: '400px' }} /> ``` ## State Machine Example ```jsx import { useRive, useStateMachineInput } from 'rive-react'; export default function InteractiveButton() { const { rive, RiveComponent } = useRive({ src: 'button.riv', stateMachines: 'Button State Machine', autoplay: true, }); const hoverInput = useStateMachineInput(rive, 'Button State Machine', 'isHovered', false); return ( <div onMouseEnter={() => hoverInput && (hoverInput.value = true)} onMouseLeave={() => hoverInput && (hoverInput.value = false)} > <RiveComponent style={{ width: '200px', height: '100px' }} /> </div> ); } ``` ## ViewModel Example ```jsx import { useRive, useViewModel, useViewModelInstance, useViewModelInstanceString } from 'rive-react'; import { useEffect } from 'react'; export default function Dashboard({ title }) { const { rive, RiveComponent } = useRive({ src: 'dashboard.riv', autoplay: true, autoBind: false, }); const viewModel = useViewModel(rive, { useDefault: true }); const instance = useViewModelInstance(viewModel, { rive }); const { setValue: setTitle } = useViewModelInstanceString('title', instance); useEffect(() => { if (setTitle) setTitle(title); }, [title, setTitle]); return <RiveComponent style={{ width: '800px', height: '600px' }} />; } ``` ## Resources - [Rive Documentation](https://rive.app/docs) - [React Rive GitHub](https://github.com/rive-app/rive-react) - [Rive Community](https://rive.app/community) - [State Machine Guide](https://rive.app/docs/state-machine) # Rive React API Reference Complete API reference for `rive-react` library. ## Installation ```bash npm install rive-react ``` ## Hooks ### useRive Main hook for initializing Rive animations. ```typescript const { rive, RiveComponent } = useRive(options); ``` **Options**: - `src` (string): Path to .riv file - `riveFile` (File): Preloaded Rive file - `artboard` (string): Artboard name - `animations` (string | string[]): Animations to play - `stateMachines` (string | string[]): State machines to activate - `layout` (Layout): Fit and alignment options - `autoplay` (boolean): Auto-play animations (default: true) - `autoBind` (boolean): Auto-bind ViewModels (default: true) - `automaticallyHandleEvents` (boolean): Handle Rive events - `useOffscreenRenderer` (boolean): Use off-screen renderer - `shouldResizeCanvasToContainer` (boolean): Auto-resize canvas ### useStateMachineInput Get state machine input reference. ```typescript const input = useStateMachineInput(rive, stateMachineName, inputName, initialValue); ``` **Input Types**: - Boolean: `input.value = true/false` - Number: `input.value = 50` - Trigger: `input.fire()` ### useViewModel Get ViewModel reference. ```typescript const viewModel = useViewModel(rive, { name: 'ViewModelName' }); // Or use default ViewModel const viewModel = useViewModel(rive, { useDefault: true }); ``` ### useViewModelInstance Get or create ViewModel instance. ```typescript // Get default instance const instance = useViewModelInstance(viewModel, { rive }); // Get named instance const instance = useViewModelInstance(viewModel, { name: 'Instance1' }); // Create new instance const instance = useViewModelInstance(viewModel, { useNew: true, rive }); ``` ### useViewModelInstanceString Bind string property. ```typescript const { value, setValue } = useViewModelInstanceString('propertyName', instance); ``` ### useViewModelInstanceNumber Bind number property. ```typescript const { value, setValue } = useViewModelInstanceNumber('propertyName', instance); ``` ### useViewModelInstanceColor Bind color property (hex number). ```typescript const { valu