#Introduction
The text input column allows you to render a text input inside the table, which can be used to update that database record without needing to open a new page or a modal:
use Filament\Tables\Columns\TextInputColumn;
TextInputColumn::make('email')
#Validation
You can validate the input by passing any Laravel validation rules in an array:
use Filament\Tables\Columns\TextInputColumn;
TextInputColumn::make('name')
->rules(['required', 'max:255'])
#Customizing the HTML input type
You may use the type() method to pass a custom HTML input type:
use Filament\Tables\Columns\TextInputColumn;
TextInputColumn::make('background_color')->type('color')
#Setting the HTML input mode
You may use the inputMode() method to set the HTML inputmode attribute, which hints at the type of keyboard to show on mobile. For numeric inputs, use inputMode('decimal') for decimal values or inputMode('numeric') for integers:
use Filament\Tables\Columns\TextInputColumn;
TextInputColumn::make('quantity')
->type('number')
->inputMode('decimal')
#Setting the numeric step
When using type('number'), you may use the step() method to set the HTML step attribute. Use step('any') for decimal values or step('1') for integers:
use Filament\Tables\Columns\TextInputColumn;
TextInputColumn::make('quantity')
->type('number')
->inputMode('decimal')
->step('1')
#Adding affix text aside the field
You may place text before and after the input using the prefix() and suffix() methods:
use Filament\Tables\Columns\TextInputColumn;
TextInputColumn::make('domain')
->prefix('https://')
->suffix('.com')
As well as allowing static values, the prefix() and suffix() methods also accept a function to dynamically calculate them. You can inject various utilities into the function as parameters.
prefix() and suffix() methods also accept a function to dynamically calculate them. You can inject various utilities into the function as parameters.-
Column
$columnFilament\Tables\ Columns\ Column The current column instance.
-
Livewire
$livewireLivewire\Component The Livewire component instance.
-
Eloquent record
$recordIlluminate\Database\ Eloquent\ Model|array<string, mixed>|null The Eloquent record or custom data array for the current table row.
-
Row loop
$rowLoopstdClass The row loop object for the current table row.
-
State
$statemixed The current value of the column, based on the current table row.
-
Table
$tableFilament\Tables\ Table The current table instance.
#Using icons as affixes
You may place an icon before and after the input using the prefixIcon() and suffixIcon() methods:
use Filament\Tables\Columns\TextInputColumn;
use Filament\Support\Icons\Heroicon;
TextInputColumn::make('domain')
->prefixIcon(Heroicon::GlobeAlt)
->suffixIcon(Heroicon::CheckCircle)
As well as allowing static values, the prefixIcon() and suffixIcon() methods also accept a function to dynamically calculate them. You can inject various utilities into the function as parameters.
prefixIcon() and suffixIcon() methods also accept a function to dynamically calculate them. You can inject various utilities into the function as parameters.-
Column
$columnFilament\Tables\ Columns\ Column The current column instance.
-
Livewire
$livewireLivewire\Component The Livewire component instance.
-
Eloquent record
$recordIlluminate\Database\ Eloquent\ Model|array<string, mixed>|null The Eloquent record or custom data array for the current table row.
-
Row loop
$rowLoopstdClass The row loop object for the current table row.
-
State
$statemixed The current value of the column, based on the current table row.
-
Table
$tableFilament\Tables\ Table The current table instance.
#Setting the affix icon's color
Affix icons are gray by default, but you may set a different color using the prefixIconColor() and suffixIconColor() methods:
use Filament\Tables\Columns\TextInputColumn;
use Filament\Support\Icons\Heroicon;
TextInputColumn::make('status')
->suffixIcon(Heroicon::CheckCircle)
->suffixIconColor('success')
As well as allowing static values, the prefixIconColor() and suffixIconColor() methods also accept a function to dynamically calculate them. You can inject various utilities into the function as parameters.
prefixIconColor() and suffixIconColor() methods also accept a function to dynamically calculate them. You can inject various utilities into the function as parameters.-
Column
$columnFilament\Tables\ Columns\ Column The current column instance.
-
Livewire
$livewireLivewire\Component The Livewire component instance.
-
Eloquent record
$recordIlluminate\Database\ Eloquent\ Model|array<string, mixed>|null The Eloquent record or custom data array for the current table row.
-
Row loop
$rowLoopstdClass The row loop object for the current table row.
-
State
$statemixed The current value of the column, based on the current table row.
-
Table
$tableFilament\Tables\ Table The current table instance.
#Lifecycle hooks
Hooks may be used to execute code at various points within the input's lifecycle:
use Filament\Tables\Columns\TextInputColumn;
TextInputColumn::make('email')
->beforeStateUpdated(function ($record, $state) {
// Runs before the state is saved to the database.
})
->afterStateUpdated(function ($record, $state) {
// Runs after the state is saved to the database.
})
#Rendering only the updated cells
By default, the whole table re-renders after a text input column is updated. You may re-render only the updated cells using partiallyRenderAfterStateUpdated() or partiallyRenderColumnsAfterStateUpdated().
#Security
#Authorization
By default, text input columns do not check model policies. Without an authorization check, users can update the column for records accessible through the table query, even if the record's update() policy denies access to its edit page.
Use authorize() to check the record's update() policy. Denied columns are disabled, and changes are rejected on the server:
use Filament\Tables\Columns\TextInputColumn;
TextInputColumn::make('email')
->authorize()
You may pass a different ability, such as authorize('updateEmail'), or a custom callback. See authorizing editable columns for callbacks and global configuration.
Check permission for the specific attribute being changed. If the column updates a related model or pivot, authorize that operation too. Alternatively, use a resource edit page or a policy-backed EditAction to apply the resource's edit authorization.