# Component variables

> For the complete documentation index, see [llms.txt](https://docs.arcweave.com/llms.txt). All pages are also available in one file, [llms-full.txt](https://docs.arcweave.com/llms-full.txt).

Source: https://docs.arcweave.com/project-items/variables/component
Section: Project Items > Variables
Description: How to create, manage, and use component-scoped variables in Arcweave

Arcscript examples: Arcscript has no delimiters, so never wrap code in `${ }`, `{{ }}`, `<< >>` or similar markers. An `arcscript` code block contains only code: each line is one segment, and a branch condition is a single expression without `if` or `endif`. An `arcweave-html` code block is element or connection label content as Arcweave stores it, the HTML that the REST API and MCP server accept: `<p>` for text, `<p></p>` for an empty line, and each Arcscript segment in its own `<pre><code>` block, with `<` written as `&lt;`. An element passed to `visits()` is written as element mention markup; replace `ELEMENT_ID` with the element ID.

Component variables are **String Field**, **Boolean**, **Integer**, or **Float** [attributes](https://docs.arcweave.com/project-items/attributes) added to a component. These types appear in the **Variables** group of the **Add attribute** menu because Arcscript treats them as variables scoped to that component.

Use a component variable from anywhere in the project by joining the component's **custom ID** and the variable's **custom ID** with a dot:

```arcscript
hero.health -= 10
```

Unqualified names resolve global variables only. For example, `health` and `hero.health` can coexist and store different values.

## Create component variables

Context: Arcweave docs > Project Items > Variables > Component variables > Create component variables

1. Find the component in the **Components** section of the sidebar.
2. Click the component to open the component editor.
3. Click **Add attribute** and select **String Field**, **Boolean**, **Number > Integer**, or **Number > Float** from the **Variables** group.
4. Enter the variable's label and initial value.

The component already has a custom ID generated when the component was created. Arcweave generates the variable's custom ID from its label. Their Arcscript reference appears as `component_custom_id.variable_custom_id`.

Component folders cannot contain attributes or variables.

## Use component variables

Context: Arcweave docs > Project Items > Variables > Component variables > Use component variables

Component variables can be read and changed from anywhere in the project. Their component custom ID is a namespace, not an access restriction.

A component variable belongs to the component itself. Attaching the component to multiple elements does not create separate copies of the variable or its value.

See [Common use cases](https://docs.arcweave.com/project-items/variables/overview#common-use-cases) for assignment, branch, and dynamic-text examples.

## Edit component and variable custom IDs

Context: Arcweave docs > Project Items > Variables > Component variables > Edit component and variable custom IDs

The component's custom ID appears beneath its name in the component editor. Select it to edit the scope used by all variables on that component.

To edit a variable's custom ID, open its three-dot menu and select **Edit Custom ID**. The variable label is for people reading the project; its custom ID is the member name used in Arcscript.

Renaming either the component or attribute custom ID updates existing Arcscript references automatically. Custom IDs cannot be empty and must follow the [variable naming rules](https://docs.arcweave.com/project-items/variables/overview#variable-names-and-custom-ids).

## Manage component variables

Context: Arcweave docs > Project Items > Variables > Component variables > Manage component variables

Open the component editor from the **Components** section or from an element where the component is attached. From there, you can:

- Drag variables to reorder them.
- Rename a variable or edit its custom ID from its three-dot menu.
- Delete a variable from its three-dot menu.

See [Attributes](https://docs.arcweave.com/project-items/attributes) for full instructions.

## Find and debug component variables

Context: Arcweave docs > Project Items > Variables > Component variables > Find and debug component variables

Project [Search](https://docs.arcweave.com/project-tools/search) can find a component variable by its label or custom ID and open the owning component.

In Play Mode, the Debugger groups component variables under the component's name and custom ID and shows their current values.

See [Play Mode](https://docs.arcweave.com/project-tools/play-mode/overview) > [Debugger](https://docs.arcweave.com/project-tools/play-mode/debugger) for full instructions.
