- Place a component inside another artboard as a nested component.
- Reference a component from a View Model property, allowing you to swap them at runtime.
- Instantiate components from scripts.
- Use components as items in Lists.
Creating a Component
Converting Artboards to Components
Any artboard can be converted into a reusable component.1
Select an artboard.
2
In the Inspector, select the Component icon or press
Shift + N.Artboards that aren’t components aren’t exported with your Rive file. This can be useful for artboards used only while authoring, such as tests or reference artboards.
Converting Objects to Components
You can select one or more objects on an artboard and convert them into a new component.1
Select the object or objects you want to convert.
2
Right-click the selection and select Create Component.
Troubleshooting
Components are self-contained, so Rive can’t create a component if the selection depends on objects outside of it. Make sure you include any required dependencies in your selection. For example, a draw order dependency that crosses the new component’s boundary will prevent the component from being created and display the “Can’t create component” error: “These dependencies point across the new component’s boundary and would break.”Placing Components
Use the Component Tool, formerly known as the Nested Artboard Tool, to place instances of components on the stage. Select the tool from the toolbar or pressN.
Click anywhere on the stage to choose from the available components and place an instance at that location.
If an artboard doesn’t appear in the component menu, make sure you’ve converted it to a component.
- Custom displays components as they’re organized in the Assets panel.
- Source/Type groups components by their source. This is particularly useful when working with Libraries.
Editing Components
Double-click a component instance to open its source component. Changes you make to the source component are reflected in all of its instances, while properties configured on individual instances remain unchanged.Component Instance Properties
Select a component instance to configure its properties in the Inspector. These properties control the data, animation, source, layout, and other behavior of that specific instance without changing the source component.You can’t change the origin of a component instance directly. To use a different origin, place the component instance inside a group and adjust the group’s origin instead.
Source
Source determines which component is displayed by the instance. Select a component directly, or data bind the source to change the component dynamically. Learn more about Data Binding.Data
Configure the data used by a component instance. Stateful Components If the component is a Stateful Component, you can set its exposed properties directly on the component instance. Model Use Model to set the view model instance used by the component.- Inherit uses a compatible view model instance from the closest parent.
- To specify an instance, add a View Model property to the parent’s view model and assign an instance to it. You can then select that property as the component’s Model.
Mode
Mode determines how the component instance sizes and responds to the space available from its parent. See Component Sizing for more information about sizing modes and their properties.Animations
Choose the animations that play on a component instance. In most cases, you’ll want to select a state machine, but you can also add one or more timeline animations. State Machine Select a state machine to run on the component instance. You can adjust its playback Speed and enable Quantize. Timeline Animations Add timeline animations to play on their own, alongside a state machine, or layered with other animations. When adding a timeline animation, choose between Simple and Remap. Simple plays the timeline normally and provides the following controls:- Mix controls how much the animation contributes when mixed with other animations.
- Speed controls the animation’s playback speed.
- Playing controls whether the animation is playing.
- Mix controls how much the animation contributes when mixed with other animations.
- Time controls the animation’s playhead as a percentage, where
0%is the beginning and100%is the end.