# Textbox

```javascript
var textbox =new Textbox({
  name:"text",//textbox name
  position:{//you enter where it will be on the screen
    x:"50%",y:"50%"
  },
  scale:{//automatically adjusts if you do not add this
    x:"25px",
    y:"25px"
  },
  layer:100,//you don't have to type is automatically set to 100
  placeholder:"sa",//it writes into it what to do when you do nothing
  value:"selam",//comes with an automatic value
  eval:`
  console.log(event.data)
  //for example, write to console, you can use functions
  `,
  removeable:true//erases itself after sending data
})
```

{% hint style="info" %}
You don't have to add anything other than name and position.
{% endhint %}

```javascript
textboxfocus = function(key){
  console.log("You focused the textbox:"+key)//textbox name
}
```

{% embed url="<https://1070416189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAoN3PvLitJVdWdsmwATH%2Fuploads%2FrZJHDFE9w6Vle7nC2TUH%2Ftextbox.mp4?alt=media&token=945996cc-7f0d-44e5-8d42-e73bd6541cd4>" %}

## Update&#x20;

```javascript
textbox.update({
    value:"hi"
})
//or 
updateData({
    name:"textbox",
    value:"hi"
})
```

## Get

```javascript
console.log(textbox.get())
console.log(getData("textbox"))
//Example
console.log(
textbox.get().value
)
```

## Remove

```javascript
textbox.remove()
removeData("textbox")
```


---

# 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://electoriaengine.gitbook.io/api/components/textbox.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.
