# SUIButton

**Members** 9

|          |                                       |                                                                  |
| -------- | ------------------------------------- | ---------------------------------------------------------------- |
| Function | [OnClick](#onclick)                   | Invoke when a user clicks the button and releases it.            |
| Property | [Enabled](#enabled)                   | Whether the button component is Enabled.                         |
| Property | [Interactable](#interactable)         | Enable Interactable if you want this button to accept input.     |
| Property | [NormalColor](#normalcolor)           | The normal color of the control.                                 |
| Property | [HighlightedColor](#highlightedcolor) | The color of the control when it is highlighted.                 |
| Property | [PressedColor](#pressedcolor)         | The color of the control when it is pressed.                     |
| Property | [DisabledColor](#disabledcolor)       | The color of the control when it is disabled.                    |
| Property | [ColorMultiplier](#colormultiplier)   | This multiplies the tint color for each transition by its value. |
| Property | [GameObject](#gameobject)             | –                                                                |

## Functions

### OnClick

void OnClick(Closure callback)

Invoke when a user clicks the button and releases it.

Parameters

| Name     | Type    | Default |
| -------- | ------- | ------- |
| callback | Closure | –       |

Returns

`void`

Example

**Lua**

```lua
function OnClickFunction()
--
end

Space.Host.ExecutingObject.UIButton.OnClick(OnClickFunction)

```

## Properties

### Enabled

bool Enabled {get; set; }

Whether the button component is Enabled.

Example

**Lua**

```lua
Space.Host.ExecutingObject.UIButton.Enabled = true

```

**Lua**

```lua
--clicking this object will toggle Enable/Disable an object's Button component

thisGameObject = Space.Host.ExecutingObject
button = Space.Host.GetReference("button").UIButton 
--make sure to add this reference to the Scripting Runtime component


OnClick = function()
button.Enabled =  not button.Enabled
end


thisGameObject.AddClickable()
thisGameObject.Clickable.OnClick(OnClick)

```

### Interactable

bool Interactable {get; set; }

Enable Interactable if you want this button to accept input.

Example

**Lua**

```lua
Space.Host.ExecutingObject.UIButton.Interactable = true

```

**Lua**

```lua
--clicking this object will toggle Interactable status on an object's Button component

thisGameObject = Space.Host.ExecutingObject
button = Space.Host.GetReference("button").UIButton 
--make sure to add this reference to the Scripting Runtime component


OnClick = function()
button.Interactable=  not button.Interactable
end


thisGameObject.AddClickable()
thisGameObject.Clickable.OnClick(OnClick)

```

### NormalColor

[SColor](/docs/scripting/client-scripting-api-reference/types/scolor.md) NormalColor {get; set; }

The normal color of the control.

Example

**Lua**

```lua
Space.Host.ExecutingObject.UIButton.NormalColor = Color.Red

```

### HighlightedColor

[SColor](/docs/scripting/client-scripting-api-reference/types/scolor.md) HighlightedColor {get; set; }

The color of the control when it is highlighted.

Example

**Lua**

```lua
Space.Host.ExecutingObject.UIButton.NormalColor = Color.Red

```

### PressedColor

[SColor](/docs/scripting/client-scripting-api-reference/types/scolor.md) PressedColor {get; set; }

The color of the control when it is pressed.

Example

**Lua**

```lua
Space.Host.ExecutingObject.UIButton.PressedColor = Color.Red

```

### DisabledColor

[SColor](/docs/scripting/client-scripting-api-reference/types/scolor.md) DisabledColor {get; set; }

The color of the control when it is disabled.

Example

**Lua**

```lua
Space.Host.ExecutingObject.UIButton.PressedColor = Color.Red

```

### ColorMultiplier

float ColorMultiplier {get; set; }

This multiplies the tint color for each transition by its value. With this you can create colors greater than 1 to brighten the colors on graphic elements whose base color is less than white.

Example

**Lua**

```lua
Space.Host.ExecutingObject.UIButton.ColorMultiplier = Color.Red

```

### GameObject

[SGameObject](/docs/scripting/client-scripting-api-reference/types/sgameobject.md) GameObject {get; }

Example

**Lua**

```lua
Space.Host.ExecutingObject.UIButton.GameObject = Color.Red

```
