> For the complete documentation index, see [llms.txt](https://htms-docs.fsh.plus/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://htms-docs.fsh.plus/concepts/static-vars.md).

# Static Vars

Added in V1

Static vars are pieces of a sample that can be replaced with a string while injecting them

## Syntax

In the sample include ${} with the var name

```html
<sample>
  <p>Static var example: ${Var}</p>
</sample>
```

And on the html include a var attribute

```html
<element var="Var:Value"></element>
```

Each static var must follow the Key:Value syntax

This is the resulting html using [inject](/commands/inject.md):

```html
<element var="Var:Value">
  <p>Static var example: Value</p>
</element>
```

For multiple static vars separate each static var with ;

```html
<element var="Var1:Value1;Var2:Value2"></element>
```

## Updating vars

If changed via js, the [Update](/functions-events/update-function.md) function needs to be called to update the contents, using [replace](/commands/replace.md) will remove the static var values so it can't be updated.
