TextInput UI component
Purpose
TextInput is a single-line text helper for short free-form values.
Inputs
| Field | Required | Type | Behavior |
|---|---|---|---|
name |
yes | string | Submitted field name. |
value |
no | string | Current input value. Omitted renders an empty input. The rendered value is escaped. |
placeholder |
no | string | Hint, not label. |
onInput |
no | Go callback | Receives live edits as a simple string callback or typed input event callback. |
onChange |
no | Go callback | Receives committed changes when the parent needs change semantics instead of live input. |
Boundary
Value is escaped. placeholder is a hint, not a label; pair the input with
Field or another visible label for accessible forms.
Example
func TitleField(draft Draft, setTitle func(string)) gx.Node {
return (
<Field label="Title">
<TextInput name="title" value={draft.Title} onInput={setTitle}></TextInput>
</Field>
)
}
Runtime Terms
Expression children document ordinary Go
expressions inside markup bodies. Typed event payloads
document when an onInput callback uses a payload instead of a plain string.