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

# DataValue

Base type for values that can be stored in inputs. Provides
functions for checking the underlying value type.

## Static Functions

### `number`

<div class="signature">
  ```lua theme={null}
  number() -> DataValueNumber
  ```
</div>

Creates a [DataValueNumber](/docs/scripting/api-reference/data-value/data-value-number) that stores a number.

```lua theme={null}
local data = DataValue.number()
data.value = 42

print(data.value) -- 42
```

### `string`

<div class="signature">
  ```lua theme={null}
  string() -> DataValueString
  ```
</div>

Creates a [DataValueString](/docs/scripting/api-reference/data-value/data-value-string) that stores a string.

```lua theme={null}
local data = DataValue.string()
data.value = 'Rive for life!'

print(data.value) -- Rive for life!
```

### `boolean`

<div class="signature">
  ```lua theme={null}
  boolean() -> DataValueBoolean
  ```
</div>

Creates a [DataValueBoolean](/docs/scripting/api-reference/data-value/data-value-boolean) that stores a boolean.

```lua theme={null}
local data = DataValue.boolean()
data.value = false

print(data.value) -- false
```

### `color`

<div class="signature">
  ```lua theme={null}
  color() -> DataValueColor
  ```
</div>

Creates a [DataValueColor](/docs/scripting/api-reference/data-value/data-value-color) that stores a [Color](/docs/scripting/api-reference/color/color).

```lua theme={null}
local data = DataValue.color()
data.value = Color.rgba(128, 55, 12, 128)

print(Color.red(data.value)) -- 255
```

## Methods

### `isNumber`

<div class="signature">
  ```lua theme={null}
  isNumber() -> boolean
  ```
</div>

Returns true if the value is a number.

```lua theme={null}
local dv: DataValueNumber = DataValue.number()
print(dv.isNumber) -- true
```

### `isString`

<div class="signature">
  ```lua theme={null}
  isString() -> boolean
  ```
</div>

Returns true if the value is a string.

```lua theme={null}
local dv: DataValueNumber = DataValue.number()
print(dv.isString) -- false
```

### `isBoolean`

<div class="signature">
  ```lua theme={null}
  isBoolean() -> boolean
  ```
</div>

Returns true if the value is a boolean.

```lua theme={null}
local dv: DataValueNumber = DataValue.number()
print(dv.isBoolean) -- false
```

### `isColor`

<div class="signature">
  ```lua theme={null}
  isColor() -> boolean
  ```
</div>

Returns true if the value is a color.

```lua theme={null}
local dv: DataValueNumber = DataValue.number()
print(dv.isColor) -- false
```
