The Table class is the foundation for building interactive data tables in Filament. It provides functionality for displaying records, searching, filtering, sorting, pagination, bulk actions, and more.
Namespace
Inheritance
Extends: Filament\Support\Components\ViewComponent
Static Methods
make()
Create a new table instance.
public static function make(HasTable $livewire): static
The Livewire component that implements the HasTable contract.
Returns the configured table instance.
Example:
use Filament\Tables\Table;
use Filament\Tables\Contracts\HasTable;
class ListUsers extends Component implements HasTable
{
public function table(Table $table): Table
{
return $table
->columns([/* ... */])
->filters([/* ... */]);
}
}
Configuration Methods
The Table class uses multiple traits that provide configuration methods:
Columns
public function columns(array | Closure $columns): static
Define the table columns.
Example:
use Filament\Tables\Columns\TextColumn;
$table->columns([
TextColumn::make('name')->searchable(),
TextColumn::make('email')->sortable(),
]);
Filters
public function filters(array | Closure $filters, ?string $layout = null): static
Define the table filters.
Example:
use Filament\Tables\Filters\SelectFilter;
$table->filters([
SelectFilter::make('status')
->options([
'active' => 'Active',
'inactive' => 'Inactive',
]),
]);
Actions
public function actions(array | Closure $actions, ?string $position = null): static
Define row actions.
Example:
use Filament\Tables\Actions\EditAction;
use Filament\Tables\Actions\DeleteAction;
$table->actions([
EditAction::make(),
DeleteAction::make(),
]);
Bulk Actions
public function bulkActions(array | Closure $actions): static
Define bulk actions for selected records.
Example:
use Filament\Tables\Actions\BulkActionGroup;
use Filament\Tables\Actions\DeleteBulkAction;
$table->bulkActions([
BulkActionGroup::make([
DeleteBulkAction::make(),
]),
]);
public function headerActions(array | Closure $actions): static
Define actions in the table header.
Example:
use Filament\Tables\Actions\CreateAction;
$table->headerActions([
CreateAction::make(),
]);
Search and Filtering
searchable()
Enable global search.
public function searchable(bool | Closure $condition = true): static
searchPlaceholder()
Set the search input placeholder.
public function searchPlaceholder(string | Closure | null $placeholder): static
Example:
$table->searchPlaceholder('Search users...');
searchOnBlur()
Only search when the input loses focus.
public function searchOnBlur(bool | Closure $condition = true): static
searchDebounce()
Set the search debounce delay.
public function searchDebounce(string | Closure | null $debounce): static
Example:
$table->searchDebounce('500ms');
Sorting
defaultSort()
Set the default sort column and direction.
public function defaultSort(string | Closure | null $column, string | Closure $direction = 'asc'): static
Example:
$table->defaultSort('created_at', 'desc');
paginated()
Enable pagination.
public function paginated(bool | array | Closure $condition = true): static
Example:
$table->paginated([10, 25, 50, 100]);
Set the default number of records per page.
public function defaultPaginationPageOption(int | Closure | null $option): static
Example:
$table->defaultPaginationPageOption(25);
Set the available page size options.
public function paginationPageOptions(array | Closure $options): static
Query Modification
query()
Modify the Eloquent query.
public function query(Closure | null $callback): static
Example:
$table->query(fn (Builder $query) => $query->where('status', 'active'));
modifyQueryUsing()
Modify the query using a callback.
public function modifyQueryUsing(Closure | null $callback): static
Empty State
emptyStateHeading()
Set the empty state heading.
public function emptyStateHeading(string | Htmlable | Closure | null $heading): static
emptyStateDescription()
Set the empty state description.
public function emptyStateDescription(string | Htmlable | Closure | null $description): static
emptyStateIcon()
Set the empty state icon.
public function emptyStateIcon(string | Closure | null $icon): static
emptyStateActions()
Set actions for the empty state.
public function emptyStateActions(array | Closure $actions): static
Display Options
striped()
Enable striped rows.
public function striped(bool | Closure $condition = true): static
poll()
Automatically refresh the table.
public function poll(string | Closure | null $interval): static
Example:
$table->poll('10s'); // Refresh every 10 seconds
deferLoading()
Defer loading until the table is visible.
public function deferLoading(bool | Closure $condition = true): static
Record Grouping
groupingDirectionSettingHidden()
Hide the grouping direction setting.
public function groupingDirectionSettingHidden(bool | Closure $condition = true): static
Reordering
reorderable()
Enable drag-and-drop reordering.
public function reorderable(string | Closure | null $column): static
Example:
$table->reorderable('sort_order');
Constants
LOADING_TARGETS
Livewire loading targets for the table.
public const LOADING_TARGETS = [
'gotoPage',
'nextPage',
'previousPage',
'removeTableFilter',
'removeTableFilters',
'reorderTable',
'resetTableFiltersForm',
'sortTable',
'tableColumnSearches',
'tableFilters',
'tableRecordsPerPage',
'tableSearch',
];
Traits
The Table class uses multiple traits for functionality:
BelongsToLivewire - Livewire component relationship
CanBeStackedOnMobile - Mobile stacking support
CanBeStriped - Striped rows
CanDeferLoading - Deferred loading
CanGroupRecords - Record grouping
CanPaginateRecords - Pagination
CanPollRecords - Auto-refresh polling
CanReorderRecords - Drag-and-drop reordering
CanSearchRecords - Search functionality
CanSortRecords - Column sorting
CanSummarizeRecords - Record summaries
HasActions - Row actions
HasArguments - Table arguments
HasBulkActions - Bulk actions
HasColumnManager - Column visibility management
HasColumns - Column configuration
HasContent - Content customization
HasEmptyState - Empty state configuration
HasFilterIndicators - Filter indicators
HasFilters - Filter configuration
HasHeader - Header customization
HasHeaderActions - Header actions
HasHeadings - Heading configuration
HasQuery - Query modification
HasQueryStringIdentifier - Query string support
HasRecordAction - Default record action
HasRecordActions - Record action configuration
HasRecordClasses - Custom record classes
HasRecords - Record management
HasRecordUrl - Record URL generation
HasToolbarActions - Toolbar actions