From 0a8f8f965c3fa670a87c132d969ae6d564ad98f6 Mon Sep 17 00:00:00 2001 From: 4ian <1280130+4ian@users.noreply.github.com> Date: Fri, 5 Jun 2026 11:16:26 +0000 Subject: [PATCH] [Auto] [Improve] Document Text Input placeholder, max length, submission, focus and appearance customization options --- automated_updates_data.json | 4 ++++ docs/gdevelop5/objects/text_input/index.md | 25 ++++++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/automated_updates_data.json b/automated_updates_data.json index b2d10e2b2e4..5b33c567b2c 100644 --- a/automated_updates_data.json +++ b/automated_updates_data.json @@ -92,6 +92,10 @@ { "date": "2026-04-22", "summary": "Improved resources-loading docs (named Preload scene action, documented SceneLoadingProgress expression and AreSceneAssetsLoaded condition, clarified custom loading screen approach) and added extension lifecycle functions table to events/functions docs" + }, + { + "date": "2026-06-05", + "summary": "Improved Text Input object docs: added placeholder and max length, input submission and focus control, and appearance customization (font, colors, border, spell check)" } ] } diff --git a/docs/gdevelop5/objects/text_input/index.md b/docs/gdevelop5/objects/text_input/index.md index 12516a78d6c..da0eb57c586 100644 --- a/docs/gdevelop5/objects/text_input/index.md +++ b/docs/gdevelop5/objects/text_input/index.md @@ -35,14 +35,39 @@ The field can be: According to the type, some devices might display visual aids or **a different keyboard** to the user (especially on mobile). Password inputs will also hide the character that the user is writing. +## Placeholder and maximum length + +A **placeholder** can be set (in the object properties or with an action) to display a hint inside the field while it's empty — for example "Enter your name". The placeholder disappears as soon as the player starts typing. + +A **maximum length** can also be set to limit how many characters the player can enter. A value of 0 means there is no limit. + ## Reading the text entered by the player After adding a Text Input object, put an instance on the scene. You can then use the expression `Text` on the object in the events to read the text. For example, this event copies the content of the field into a [Text object](/gdevelop5/objects/text) (to display it somewhere else on the screen): ![](pasted/20220310-010309.png) +## Detecting when the input is submitted + +Use the **"Input is submitted"** condition to react when the player validates the field, which usually happens when the *Enter* key is pressed on a keyboard, or a specific button is used on mobile virtual keyboards. This is convenient to confirm a search bar or move to the next field of a form without adding a separate button. + +## Focusing the field + +You can check if a field currently has focus (the cursor is in it and the player can type) with the **"Focused"** condition, and give it focus from events with the **"Focus"** action — as if the player had touched or clicked it. This is useful to automatically select the first field of a form when a scene starts. + ## Read-only and disabled fields You can set, either from the object properties or using actions, the field as : * Read-only. Text can still be selected and usually the appearance of the field does not change, but the text can't be modified. * Disabled. Text usually can't be selected, nor modified, and some devices or platforms will gray the input. + +## Customizing the appearance + +The field can be styled both from the object properties and with actions, so it can match the look of your game: + +* The **font**, **font size** and **text color** of the entered text and placeholder. +* The **text alignment** (left, center or right). +* The **fill color** and its opacity, used for the background of the field. +* The **border color**, opacity and width. + +You can also disable **spell check** to avoid the red underline some platforms add under words.