Input
A text field. Commits on Enter, or when it loses focus.
The smallest input#
main:Input({
Text = "Target player",
Callback = function(text)
target = text
end,
})Preview
My Script
v1.0
Search…
Ember v1Filter
When it fires#
The callback runs when the field commits, which is pressing Enter or clicking away after changing the text. It does not run per keystroke.
Set FireOnBlur = false for a field that should only ever commit on Enter.
Clicking away still keeps the text and still saves it; it just does not call
back.
main:Input({
Text = "Teleport to",
Placeholder = "Username…",
FireOnBlur = false,
Callback = teleportTo,
})Building it up#
Hint at what goes in it:
main:Input({
Text = "Target player",
Placeholder = "Username…",
Callback = setTarget,
})React as they type by reading the box yourself, which is the only way to get per-keystroke behaviour:
local filter = main:Input({ Text = "Filter" })
local box = filter.Instance:FindFirstChildWhichIsA("TextBox", true)
box:GetPropertyChangedSignal("Text"):Connect(function()
applyFilter(box.Text)
end)Every option#
| Option | Type | Default | What it does |
|---|---|---|---|
Textreq | string | — | The label. |
Callback | function(string) | — | Called with the field's contents when it commits. |
Placeholder | string | — | Ghost text shown while the field is empty. |
Default | string | "" | Starting contents. |
FireOnBlur | boolean | true | Commit on losing focus as well as on Enter. Set false for Enter only. |
FireOnStart | boolean | false | Call Callback once with the starting contents. |
Style | string | "outline" | Visual variant, matching the button styles: outline, filled, ghost or soft. |
Description | string | — | A quieter second line. |
Icon | string | — | An icon shown before the label. |
Save | string | boolean | — | Persist under this key. true derives one from the section and label. |
Tooltip | string | — | Shown while the pointer is over the control. |
Disabled | boolean | false | Refuses input and dims the control. |
DisabledReason | string | — | Shown as a tooltip while it is disabled. |
A saved field calls Callback once with the value it restored. See
Saving settings.
Methods#
| Method | Returns | What it does |
|---|---|---|
Get() | string | The current contents |
Set(text) | true | Replaces the contents and fires Callback |
Set(text, true) | true | Replaces the contents without firing Callback |