> For the complete documentation index, see [llms.txt](https://lua2.fatality.win/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://lua2.fatality.win/api/instances/gui/control/textinput.md).

# TextInput

This type represents a text input control.

{% hint style="info" %}
This type inherits [`Control`](/api/instances/gui/control.md) type. All of its base methods and fields are also available in this type.
{% endhint %}

## \_\_call﻿ <a href="#call" id="call"></a>

[<kbd><mark style="background-color:purple;">**Constructor**<mark style="background-color:purple;"></kbd>](#user-content-fn-1)[^1]

Constructs the text input.

**Arguments**

| Name | Type                                                           | Description |
| ---- | -------------------------------------------------------------- | ----------- |
| `id` | [`ControlID`](/api/instances/gui/types/controlid.md)`\|string` | ID.         |

**Returns**

| Type        | Description          |
| ----------- | -------------------- |
| `TextInput` | Text input instance. |

**Example**

```lua
local sp = gui.text_input(id);
```

***

## placeholder﻿ <a href="#placeholder" id="placeholder"></a>

[<kbd><mark style="background-color:purple;">**Field**<mark style="background-color:purple;"></kbd>](#user-content-fn-2)[^2]

Type: `string`

Placeholder text.

***

## value﻿ <a href="#value" id="value"></a>

[<kbd><mark style="background-color:purple;">**Field**<mark style="background-color:purple;"></kbd>](#user-content-fn-2)[^2][<kbd><mark style="background-color:orange;">**Read only**<mark style="background-color:orange;"></kbd>](#user-content-fn-3)[^3]

Type: `string`

Value.

***

## SetValue <a href="#set-value" id="set-value"></a>

[<kbd><mark style="background-color:purple;">**Method**<mark style="background-color:purple;"></kbd>](#user-content-fn-4)[^4]

Sets the new text.

**Arguments**

| Name  | Type     | Description |
| ----- | -------- | ----------- |
| `str` | `string` | New value.  |

**Returns**

Nothing.

**Example**

```lua
input:SetValue('Hello!');
```

[^1]: This is a constructor definition for this type.

[^2]: This field is a regular field that must be accessed using a dot (.)

[^3]: This field is a read only field, and you cannot change its value. This does not apply to child fields, if any.

[^4]: This field is a method and must be invoked using a colon (:)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://lua2.fatality.win/api/instances/gui/control/textinput.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
