Skip to content
Limited timeStarter is now $9 a month instead of $20.See plans
charmotion

Rive Data Binding vs. State Machine Inputs: When to Use Each & Migration Guide

By the Charmotion team · Updated · How we write guides

Cover illustration for the guide: Rive Data Binding vs. State Machine Inputs: When to Use Each & Migration Guide, with Charmotion demo characters

Use Rive data binding for new work when your app needs typed values like text, colors or numbers that code reads and writes. Keep state machine inputs for simple on or off and number switches, or when your runtime lacks the API you need. Migrating means mapping each input to a matching ViewModel property.

Key takeaways

  • Use data binding for typed values like text, colors and images that app code reads and writes.
  • Use state machine inputs for number, boolean and trigger switches between states.
  • Migrate by mapping each input to a ViewModel property and keeping the inputs until every build is updated.
  • Check minimum runtime versions: Flutter 0.15.0 needs Flutter 3.32.0, and Apple's 6.28.0 changes default binding.

Rive Data Binding vs State Machine inputs which should I use for your app?

Use data binding when your app needs to read and write typed values, and keep state machine inputs for simple switches. Both live in the same .riv file and both are set from app code, but they solve different problems.

QuestionState machine inputsData binding (ViewModel)
Where it is definedOn the state machine, by nameAs a ViewModel in the Rive editor, with typed properties
Value typesNumber, boolean, triggerNumber, Boolean, Trigger, Color, String, Enum, Image, nested ViewModel, List
How code uses itFind the input by name, then set its value or fire itCreate a ViewModelInstance and read or write its properties
Best forSwitching states, such as idle to happyValues the UI sets, such as a name, a score or a theme color

A simple rule: if your app only needs to tell a mascot which state to play, a state machine input is enough. If it needs to push a name, a brand color or a score into the animation, use data binding.

How do Rive state machine inputs work?

A state machine is the set of states and transitions a designer builds in Rive. Its inputs are the values that move the machine between states. There are three types: number (a float), boolean (true or false) and trigger (a one-shot signal).

In the web runtime you list a state machine's inputs with stateMachineInputs and the state machine name, then find the input you need by name. Boolean and number inputs expose a value property you can read and set. Triggers are fired by calling a method on the input.

const inputs = rive.stateMachineInputs('State Machine 1');
const hovered = inputs.find(function (input) { return input.name === 'isHovered'; });
hovered.value = true;

The Android runtime exposes separate methods for number, boolean and trigger values, called through the view. In Flutter you create a state machine controller from an artboard and a state machine name, then read the inputs from controller.stateMachine.inputs. The pattern is the same everywhere: look up by name, then write.

The weakness is coupling. Your code depends on an exact input name, and each input holds a single number, boolean or trigger, so text and colors need workarounds. For how states are built, see Rive state machine inputs, triggers and moods.

How does Rive data binding work?

Data binding moves the values out of the state machine and into a ViewModel. A designer defines the ViewModel in the Rive editor, with a property for each value the app should control. App code then creates a ViewModelInstance and reads or writes its properties at runtime.

Property types include Number, String, Boolean, Color, Enum, Trigger, Image, nested View Model and List. That range is the main reason to choose data binding: a text label, a theme color or an avatar image can come from code without a separate file.

Each runtime exposes the same idea with its own API:

  • Web: a viewModelInstance getter for the bound instance, a viewModel(path) method that returns a ViewModelInstance, setViewModelInstance to assign an instance without binding it, bind() to apply the instances that were set, and getBindableArtboard(name) to bind an instance through an artboard's viewModel property.
  • React Native: a useViewModelInstance hook that creates an instance from a RiveFile, a ViewModel or a RiveViewRef. The async option needs @rive-app/react-native 0.4.18 or later.
  • Flutter: a ViewModel can create blank, default, indexed or named instances, and each instance can be disposed.
  • Apple: from v6.28.0, authored default instances bind automatically.
  • Android and Unity: Android runtime 11.13.0 added font data binding and an ASSET_BLOB property type. Unity runtime 0.4.5 added Fonts and Global View Models.

For platform walkthroughs, read Rive data binding in SwiftUI and Rive mascots in Unity UI.

What are the practical differences in a shipped app?

Five differences matter once an app is in production.

  1. Naming. Inputs are matched by string name in code. ViewModel properties are also referenced by name, but each one has a declared type, so the app works with text, colors and numbers directly.
  2. Value types. Inputs hold a number, a boolean or a trigger. Properties also hold strings, colors, images and lists.
  3. Instances. One ViewModel can produce several instances, so one file can show different data in different places, such as a profile card and a chat header.
  4. Binding timing. Timing depends on the runtime. In Flutter 0.15.0 and later, binding happens when a RiveWidgetController is created. In the Apple runtime, authored defaults bind automatically from 6.28.0.
  5. Version floor. Data binding needs a recent enough runtime, so check the minimum version for each platform before you depend on it.

For a comparison that also covers Lottie files, see Lottie vs Rive state machines and data binding.

How do you migrate from state machine inputs to data binding?

Migrate one screen at a time, and keep the old inputs until every build reads the new properties.

  1. Inventory each input. List every number, boolean and trigger input in each state machine, and the app code that sets it.
  2. Create a ViewModel. In the editor, add one property per input with the matching type: Number, Boolean or Trigger. Add Color, String or Image properties for values inputs could not carry.
  3. Keep the inputs. Leave them in the file until every app build reads the new properties. Older builds that still read the inputs keep working.
  4. Switch app code. On the web, read the viewModelInstance or use viewModel(path). In Flutter 0.15.0 and later, remove dataBind calls. On Apple 6.28.0 and later, drop DataBind and use the new initializers, since Rive.viewModelInstance returns nil with them.
  5. Test every state. Check each state and trigger on each platform you ship. Remove the old input calls first, and the inputs last.

Two version rules apply. Flutter 0.15.0 needs Flutter 3.32.0 (Dart 3.8.0) or later. The Apple DataBind API is deprecated, so replace it when you update the runtime.

When should you keep state machine inputs?

Keep inputs when the job is small and stable:

  • A mascot with three to five states that code only switches, such as idle, happy and loading.
  • A shipped file that older app builds still read. Changing input names breaks them.
  • A runtime or platform where you have not yet confirmed the data binding API your app needs.
  • A prototype where a designer only needs to test transitions.

Use data binding when the app supplies content: a user's name in a greeting, a status message from a server, or a theme color that changes with dark mode. For a Vue or Nuxt app, the setup and SSR details are in Rive in Vue 3 and Nuxt. For mood-based characters driven by app state, see driving Rive mood states from app state.

Which runtime versions support the newer data binding APIs?

RuntimeChangeVersion
FlutterBinding on controller creation; separate dataBind call removed0.15.0, needs Flutter 3.32.0 (Dart 3.8.0)
React NativeuseViewModelInstance async option@rive-app/react-native 0.4.18 or later
AppleAutomatic binding of default instances; DataBind deprecated6.28.0
AndroidFont data binding; ASSET_BLOB property type11.13.0
UnityFonts and Global View Models0.4.5

These are the changes named in Rive's runtime release notes and migration guide, as of December 2026. Rive's runtime pages list the newest release for each platform, so use that number for new projects.

Migrate Rive state machine inputs to data binding

  1. Inventory each input. List every number, boolean and trigger input in each state machine, and the app code that sets it.
  2. Create a ViewModel. In the Rive editor, add one property per input with the matching type: Number, Boolean or Trigger. Add Color, String or Image properties for values inputs could not carry.
  3. Keep the inputs. Leave the existing inputs in the file until every app build reads the new properties.
  4. Switch app code per runtime. On the web, read the viewModelInstance or use viewModel(path). In Flutter 0.15.0 and later, remove dataBind calls. On Apple 6.28.0 and later, replace DataBind with the new initializers.
  5. Test every state. Check each state and trigger on each platform you ship, then remove the old input calls and finally the inputs.

Frequently asked questions

Is Rive data binding available on the free plan?

This guide does not state plan limits, so check current pricing before you rely on a feature. Exported files on Rive's Free plan play a Rive splash screen, and paid plans export without it. The guide Is Rive Free? Rive Pricing, Plans and Commercial Use in 2026 covers the plan overview as of December 2026.

Can a trigger from my app fire a Rive animation?

Yes, in both systems. A trigger state machine input is fired by calling its method in the runtime, and a ViewModel also has a Trigger property type. The method names differ between platforms, so check your runtime's page for the exact call.

Are Unreal and C++ data binding APIs covered here?

No. Unreal and C++ data binding APIs and their minimum versions are not covered in this guide. Check Rive's runtime pages for those platforms (as of December 2026) before you plan data binding there.

Will migrating break existing Rive files?

Not if you keep the old inputs until every app build reads the new properties. Removing inputs from the file should be the last step, after testing each state and trigger on every platform you ship.

Sources

Related guides