Text input
The text input collects a single line of text. Create one with TextInput::make(), passing the field name and its label.
TextInput::make('name', 'Team name') ->placeholder('My team') ->required()- autoComplete:null
- autoFocus:false
- columnWidth:"md"
- conditions:null
- dependsOnAny:false
- dependsOnKeys:null
- disabled:false
- editablePrefill:false
- helperText:null
- hidden:false
- label:"Team name"
- name:"name"
- placeholder:"My team"
- prefillRefreshOn:null
- prefillResetOn:null
- prefix:null
- readOnly:false
- required:true
- suffix:null
- tabIndex:null
- tooltip:null
- type:null
- value:null
Placeholder
Section titled “Placeholder”->placeholder() sets the muted hint shown while the field is empty. It is not a value — an empty
field still submits as empty.
Call ->email() to set the HTML input type to email and apply email validation:
TextInput::make('email', 'Email address') ->email()- autoComplete:null
- autoFocus:false
- columnWidth:"md"
- conditions:null
- dependsOnAny:false
- dependsOnKeys:null
- disabled:false
- editablePrefill:false
- helperText:null
- hidden:false
- label:"Email address"
- name:"email"
- placeholder:"[email protected]"
- prefillRefreshOn:null
- prefillResetOn:null
- prefix:null
- readOnly:false
- required:false
- suffix:null
- tabIndex:null
- tooltip:null
- type:"email"
- value:null
Affixes
Section titled “Affixes”->prefix() and ->suffix() attach a small adornment to the start or end of the input — a unit, a
currency symbol, or an icon. Pass a string for literal text, or an Icon enum
case for an icon:
TextInput::make('price', 'Price') ->prefix('$') ->suffix('USD')- autoComplete:null
- autoFocus:false
- columnWidth:"md"
- conditions:null
- dependsOnAny:false
- dependsOnKeys:null
- disabled:false
- editablePrefill:false
- helperText:null
- hidden:false
- label:"Price"
- name:"price"
- placeholder:null
- prefillRefreshOn:null
- prefillResetOn:null
- prefix:{"icon":null,"text":"$"}
- readOnly:false
- required:false
- suffix:{"icon":null,"text":"USD"}
- tabIndex:null
- tooltip:null
- type:null
- value:null
TextInput::make('search', 'Search') ->prefix(Icon::Search)- autoComplete:null
- autoFocus:false
- columnWidth:"md"
- conditions:null
- dependsOnAny:false
- dependsOnKeys:null
- disabled:false
- editablePrefill:false
- helperText:null
- hidden:false
- label:"Search"
- name:"search"
- placeholder:null
- prefillRefreshOn:null
- prefillResetOn:null
- prefix:{"icon":"search","text":null}
- readOnly:false
- required:false
- suffix:null
- tabIndex:null
- tooltip:null
- type:null
- value:null
The rule is the argument type: an Icon enum (or any backed enum) renders as an icon, a plain
string renders as text. To use an icon that isn’t an Icon case — for example a host app’s own
sprite name — reach for the explicit Affix value object:
use Lattice\Lattice\Support\Affix;
TextInput::make('search', 'Search')->prefix(Affix::icon('custom-glyph'));TextInput::make('weight', 'Weight')->suffix(Affix::text('kg'));Autocomplete
Section titled “Autocomplete”->autoComplete() sets the HTML autocomplete attribute so the browser can offer saved values.
Pass any valid token, such as organization, username, or off.
TextInput::make('company', 'Company')->autoComplete('organization');Autofocus
Section titled “Autofocus”->autoFocus() focuses the field when the form mounts. Use it on the first field only.
TextInput::make('name', 'Team name')->autoFocus();Tab index
Section titled “Tab index”->tabIndex() overrides the keyboard tab order. Most forms should rely on the natural document
order instead.
TextInput::make('name', 'Team name')->tabIndex(1);Common options
Section titled “Common options”TextInput shares label, default value, required, disabled, read-only, and visibility options with
every field — see Fields. For validation and conditional behavior, see
Validation and Conditional fields.