# InputField

## What is it ?

Inputfield is made to enter a text, numbers, email etc... really useful to interract with player if you need a text.

## How create it ?

You have to add InputField component in a [GameObject](https://kap35.gitbook.io/kap-engine-wiki/user-manual/gameobject). All component require will be added by the InputField.

Example :&#x20;

```cpp
auto inputFieldObject = scene.createScene("My Button");

auto inputField = std::make_shared<KapEngine::UI::Inputfield>(inputFieldObject);
inputFieldObject->addComponent(inputField);
```

## Functions

* setPlaceholderText : set the text of placeholder (text display when there is no content)
* setInputType : set the type of input (to allow keys or not)
* setBackground : set an image in background of button

Example :&#x20;

```cpp
auto inputFieldObject = scene.createScene("My Button");

auto inputField = std::make_shared<KapEngine::UI::Inputfield>(inputFieldObject);
inputFieldObject->addComponent(inputField);

//call all available functions
inputField->setPlaceholderText("My placeholder...");

//at base InputType is set for text but you can change it like that :
KapEngine::UI::Inputfield::InputType type;
type = KapEngine::UI::Inputfield::InputType::PASSWORD;
inputField->setInputType(type);

inputField->setbackground("path/image.png", {0, 0, 100, 100});

```


---

# Agent Instructions: 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://kap35.gitbook.io/kapui/user-manual/ui-elements/inputfield.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.
