> ## Documentation Index
> Fetch the complete documentation index at: https://rive-components.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Components

> Create reusable artboards that can be instanced throughout your Rive files.

export const YouTube = ({id, timestamp}) => {
  const videoSrc = timestamp ? `https://www.youtube.com/embed/${id}?start=${timestamp}` : `https://www.youtube.com/embed/${id}`;
  return <iframe width="100%" height="400" src={videoSrc} title="YouTube video player" frameBorder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerPolicy="strict-origin-when-cross-origin" allowFullScreen />;
};

Components are reusable artboards. Create a component once, then use customized instances of it throughout your Rive file. Changes made to the source component are reflected across all of its instances.

You can use components in several ways:

* Place a component inside another artboard as a nested component.
* Reference a component from a [View Model property](/editor/data-binding/property-types#view-model), allowing you to swap them at runtime.
* [Instantiate components from scripts](/scripting/protocols/node-scripts#instantiating-components).
* Use components as items in [Lists](/editor/data-binding/lists).

Components can include their own graphics, animations, state machines, and data, allowing you to build complex experiences from smaller, reusable pieces.

<YouTube id="HRUr9mnh41A" />

## Creating a Component

### Converting Artboards to Components

Any artboard can be converted into a reusable component.

<Steps>
  <Step>
    Select an artboard.
  </Step>

  <Step>
    In the Inspector, select the **Component** icon or press `Shift` + `N`.
  </Step>
</Steps>

You can identify components by their purple artboard title on the stage.

<img src="https://mintcdn.com/rive-components/6UxvLd68RKelfmnO/images/editor/artboards/convert-to-component.gif?s=563ec2317ba0b46da3107aa4d64685f3" alt="Convert an artboard to a component" width="640" height="289" data-path="images/editor/artboards/convert-to-component.gif" />

<Note>
  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.
</Note>

### Converting Objects to Components

You can select one or more objects on an artboard and convert them into a new component.

<Steps>
  <Step>
    Select the object or objects you want to convert.
  </Step>

  <Step>
    Right-click the selection and select **Create Component**.
  </Step>
</Steps>

Rive creates a new component containing the selected objects and replaces the original selection with an instance of that component.

<img src="https://mintcdn.com/rive-components/ZgXBc84ARQW7zapb/images/editor/artboards/convert-object-to-component.gif?s=4a7958f699301d4c29109f963901b377" alt="Create a new component from an element inside the artboard" width="640" height="335" data-path="images/editor/artboards/convert-object-to-component.gif" />

**Animations and State Machines**

If the selected objects are animated by a timeline on the original artboard, the relevant keys are removed from that timeline and copied to a new timeline inside the component.

State machines aren't copied to the new component. State machines can depend on objects, animations, data, and other elements outside the selection, so you'll need to create a new state machine inside the component.

Data bindings are copied to the new component, but their view models are not.

#### 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."**

<img src="https://mintcdn.com/rive-components/6UxvLd68RKelfmnO/images/editor/artboards/cannot-create-new-component.png?fit=max&auto=format&n=6UxvLd68RKelfmnO&q=85&s=a8102588a685c09aa40022e536b36c9e" alt="Can't create component error caused by a dependency crossing the component boundary" width="1018" height="414" data-path="images/editor/artboards/cannot-create-new-component.png" />

## 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 press `N`.

Click anywhere on the stage to choose from the available components and place an instance at that location.

<img src="https://mintcdn.com/rive-components/6UxvLd68RKelfmnO/images/editor/artboards/place-component.gif?s=6d38f1a01ffe06878e62a0a85664ff8d" alt="Placing a component instance by clicking stage with the Component Tool and choosing from the menu of available components" width="640" height="339" data-path="images/editor/artboards/place-component.gif" />

<Note>
  If an artboard doesn't appear in the component menu, make sure you've [converted it to a component](#converting-artboards-to-components).
</Note>

Alternatively, use the dropdown next to the **Component Tool** to choose a component before placing it.

<img src="https://mintcdn.com/rive-components/6UxvLd68RKelfmnO/images/editor/artboards/place-specific-component.gif?s=5079d7ff84359f33f6ffe191065acb05" alt="Placing a component instance by clicking the Component Tool dropdown, selecting a component, and clicking the stage" width="640" height="339" data-path="images/editor/artboards/place-specific-component.gif" />

The component menu follows the sort mode used in the Assets panel:

* **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](/editor/libraries).

<img src="https://mintcdn.com/rive-components/6UxvLd68RKelfmnO/images/editor/artboards/assets-sort.png?fit=max&auto=format&n=6UxvLd68RKelfmnO&q=85&s=657c7128d033925161b1ae1f1b289610" alt="Sort assets by Custom" width="269" height="355" data-path="images/editor/artboards/assets-sort.png" />

## 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.

<img src="https://mintcdn.com/rive-components/6UxvLd68RKelfmnO/images/editor/artboards/edit-component.gif?s=74e335bab07a3433ed29da9fdc2f9a2b" alt="Double click to edit a component" width="640" height="397" data-path="images/editor/artboards/edit-component.gif" />

## 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.

<img src="https://mintcdn.com/rive-components/6UxvLd68RKelfmnO/images/editor/artboards/component-properties.png?fit=max&auto=format&n=6UxvLd68RKelfmnO&q=85&s=833d55cf02f4448afdf732f8c2cdfad6" alt="Component properties in the sidebar" width="2398" height="1352" data-path="images/editor/artboards/component-properties.png" />

<Note>
  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.
</Note>

### 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](/editor/data-binding).

### Data

Configure the data used by a component instance.

**Stateful Components**

If the component is a [Stateful Component](/editor/data-binding/stateful-components), 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**.

Learn more about [View Models and Instances](/editor/data-binding/view-models).

### Mode

**Mode** determines how the component instance sizes and responds to the space available from its parent. See [Component Sizing](/editor/layouts/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.

**Remap** lets you control the position of the animation's playhead directly:

* **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 and `100%` is the end.
