# Defold TextInput

**URL:** <https://forum.defold.com/t/defold-textinput/77560>\
**Category:** The Defoldmine\
**Created:** [July 25, 2024, 2:38pm UTC](https://forum.defold.com/t/defold-textinput/77560 "2024-07-25T14:38:15Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Chung\_Xa](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/chung_xa/32/34470_2.png) [@Chung\_Xa](https://forum.defold.com/u/Chung_Xa)\
**Post date:** [July 25, 2024, 2:38pm UTC](https://forum.defold.com/t/defold-textinput/77560/1 "2024-07-25T14:38:15Z")

</div>

Hi everyone,  
If you are not very statisfied with built-in Defold text input method, this extension can help you as it uses a real native text field to handle the text you input, so you can type whatever text you want in your language, no mater marked text, no delay or missing characters issue as well.

There are 2 types of text input field, normal and hidden. The hidden field is surely what you are expecting, I think.

Check it out: [Defold TextInput (github.com)](https://github.com/baochungit/defold-textinput)

Demo: [defold-textinput (baochungit.github.io)](https://baochungit.github.io/defold-textinput/)

Hope it helps! Cheers!

---

<div class="post-metadata">

**Author:** ![selimanac](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/selimanac/32/6397_2.png) [@selimanac](https://forum.defold.com/u/selimanac)\
**Post date:** [July 25, 2024, 4:10pm UTC](https://forum.defold.com/t/defold-textinput/77560/2 "2024-07-25T16:10:53Z")

</div>

Great work, thank you.

---

<div class="post-metadata">

**Author:** ![Chung\_Xa](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/chung_xa/32/34470_2.png) [@Chung\_Xa](https://forum.defold.com/u/Chung_Xa)\
**Post date:** [July 26, 2024, 1:01pm UTC](https://forum.defold.com/t/defold-textinput/77560/3 "2024-07-26T13:01:32Z")

</div>

It now supports for HTML5 (web platform). However on mobile, some browsers require users to interact with the input element to be able to show the keyboard. In this case, using a normal text input might be the best option.

---

<div class="post-metadata">

**Author:** ![Chung\_Xa](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/chung_xa/32/34470_2.png) [@Chung\_Xa](https://forum.defold.com/u/Chung_Xa)\
**Post date:** [July 28, 2024, 7:24am UTC](https://forum.defold.com/t/defold-textinput/77560/4 "2024-07-28T07:24:19Z")

</div>

Hi guys, it’s now able to show virtual keyboard for hidden inputs on mobile browsers but it still requires a touch (interaction) onto the input delegation.

---

<div class="post-metadata">

**Author:** ![Spyros\_P](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/spyros_p/32/28347_2.png) [@Spyros\_P](https://forum.defold.com/u/Spyros_P)\
**Post date:** [May 9, 2026, 3:12pm UTC](https://forum.defold.com/t/defold-textinput/77560/5 "2026-05-09T15:12:35Z")

</div>

I had some issues with supporting Android predictive keyboards (handling text/marked-text is a bit tedious, handling a non-basic cursor at the end of input seems almost impossible, on some keyboards predictive/swipe typing produces duplicate output etc). I used this extension (v1.1.3) and it worked for my use case, with two issues:

a. On iOS, even though I set my input field as KEYBOARD\_TYPE\_EMAIL, I get password suggestions from the OS, as if it’s defined as a password field. I do see what I type though, so it’s not a password field.

b. On Android, for which I mainly used the extension, I had success in most devices. There are some devices though where, for some reason. the text input is placed below the area I want it to be rendered in. When this happens, all my gui.pick\_node hit areas also seem to be offset by the same distance (around 32px towards the bottom). It’s as if the placement on the native input box messes up the UI coordinates. The devices where this happens (I’ve seen in on two) are very tall and narrow (1080x2416 or so). I also use the safe area extension, so I don’t know if there’s any conflict, just mentioning.

Disabling the extension and returning to my standard Defold input fixes this behavior.

In general Defold has been smooth sailing, except for mobile keyboard handling 🙂

Here is how I set my input element up:

```lua
ti_email_id = textinput.create(false, make_email_listener(self))
		textinput.set_keyboard_type(ti_email_id, textinput.KEYBOARD_TYPE_EMAIL)
		textinput.set_auto_capitalize(ti_email_id, textinput.CAPITALIZE_NONE)
		textinput.set_return_key_type(ti_email_id, textinput.RETURN_KEY_TYPE_NEXT)
		textinput.set_max_length(ti_email_id, 64)
		textinput.set_text_color(ti_email_id, "#ffffff")
		textinput.set_visible(ti_email_id, false)

```

And this is how I place it in the gut node I want it rendered in:

```lua
local function calc_position_and_size(node)
	local _, window_height = window.get_size()
	local window_scale = get_window_scale()
	local pos = gui.get_screen_position(node)
	local size = gui.get_size(node)
	local scale = get_screen_scale()
	local width, height = size.x * scale, size.y * scale
	return {
		position = {
			x = (pos.x - width / 2) * window_scale,
			y = (window_height - pos.y - height / 2) * window_scale,
		},
		size = { width = width * window_scale, height = height * window_scale },
	}
end

```

---

<div class="post-metadata">

**Author:** ![MasterMind](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/mastermind/32/31839_2.png) [@MasterMind](https://forum.defold.com/u/MasterMind)\
**Post date:** [November 6, 2026, 1:01am UTC](https://forum.defold.com/t/defold-textinput/77560/6 "2026-11-06T01:01:15Z")

</div>

This is very useful thank you!

---

<div class="post-metadata">

**Author:** ![blenser4](https://forum-defold.b-cdn.net/letter_avatar_proxy/v4/letter/b/bbce88/32.png) [@blenser4](https://forum.defold.com/u/blenser4)\
**Post date:** [November 6, 2026, 1:08am UTC](https://forum.defold.com/t/defold-textinput/77560/7 "2026-11-06T01:08:32Z")

</div>

This looks really handy for mobile games, where text entry can be awkward. The keyboard type support and the way it places the field in the GUI make it feel like a proper native input. Thanks for sharing the extension and keeping it updated.
