Skip to main content

Data Binding

Data Binding connects values stored in View Models (containers that hold your app's data) to properties in your Rive scene. Think of it like a spreadsheet formula — change the source value, and every cell that references it updates instantly. When the data changes, the scene hierarchy (the nested layer structure of objects in your design) updates automatically. When properties change in the scene, the data can update too.

What Can You Bind?

  • An enemy's X/Y position, controlled from runtime code (the code that runs your app, written by a developer)
  • A single color property shared across many icons
  • A health value that drives both a health bar and the character's appearance
  • Images, artboards, or components swapped based on app state

Why Use Data Binding?

Data Binding separates your data from your design. Think of it like a spreadsheet formula: the formula (your data) sits in one place, and multiple cells (scene elements) update automatically when the value changes — no matter how deep in the design they are.

Once bound, you can move, rename, or restructure elements in the hierarchy without touching your runtime code. The binding handles the connection.

Core Concepts

  1. View Models — Define the structure of your data model (the structure of values your app works with — like a list of properties and their types).
  2. View Model Instances — Hold the actual values for those properties.

Think of a View Model as a blank form template, and a View Model Instance as a filled-in copy of that form. One template, many instances — each with its own values.

  1. Bindings — Connect a View Model property to a scene property (position, color, text, etc.).
  2. Updating Data — Data can be changed from the editor, runtime code, state machines, or scripting.
  3. Automatic Updates — When data changes, all bound elements update immediately.

Learn More