Filament\Tables\Columns namespace.
If you’re using the columns in a Livewire component, you can put them in the getTableColumns() method:
$table->columns() method:
make() method, passing its name. The name of the column should correspond to a column or accessor on your model. You may use “dot syntax” to access columns within relationships.
Available columns
Filament ships with two main types of columns - static and editable. Static columns display data to the user: Editable columns allow the user to update data in the database without leaving the table: You may also create your own custom columns to display data however you wish.Setting a label
By default, the label of the column, which is displayed in the header of the table, is generated from the name of the column. You may customize this using thelabel() method:
translateLabel() method:
Sorting
Columns may be sortable, by clicking on the column label. To make a column sortable, you must use thesortable() method:
sortable() an array of database columns to sort by:
sortable(), you may choose to sort it by default using the getDefaultTableSortColumn() and getDefaultTableSortDirection() methods:
Persist sort in session
To persist the sort in the user’s session, override theshouldPersistTableSortInSession() method on the Livewire component:
Searching
Columns may be searchable, by using the text input in the top right of the table. To make a column searchable, you must use thesearchable() method:
searchable() an array of database columns to search within:
Searching individually
You can choose to enable a per-column search input using theisIndividual parameter:
isIndividual parameter, you may still search that column using the main “global” search input for the entire table.
To disable that functionality while still preserving the individual search functionality, you need the isGlobal parameter:
Persist search in session
To persist the table or individual column search in the user’s session, override theshouldPersistTableSearchInSession() or shouldPersistTableColumnSearchInSession() method on the Livewire component:
Cell actions and URLs
When a cell is clicked, you may run an “action”, or open a URL.Running actions
To run an action, you may use theaction() method, passing a callback or the name of a Livewire method to run. Each method accepts a $record parameter which you may use to customize the behaviour of the action:
Action modals
You may open action modals by passing in anAction object to the action() method:
action() method must have a unique name to distinguish it from other actions within the table.
Opening URLs
To open a URL, you may use theurl() method, passing a callback or static URL to open. Callbacks accept a $record parameter which you may use to customize the URL:
Setting a default value
To set a default value for fields with anull state, you may use the default() method:
Hiding columns
To hide a column conditionally, you may use thehidden() and visible() methods, whichever you prefer:
Toggling column visibility
Users may hide or show columns themselves in the table. To make a column toggleable, use thetoggleable() method:
Calculated state
Sometimes you need to calculate the state of a column, instead of directly reading it from a database column. By passing a callback function to thegetStateUsing() method, you can customize the returned state for that column based on the $record:
Tooltips
If you want to use tooltips outside of the admin panel, make sure you haveYou may specify a tooltip to display when you hover over a cell:@ryangjchandler/alpine-tooltipinstalled in your app, includingtippy.css. You’ll also need to installtippy.cssif you’re using a custom admin theme.
Custom attributes
The HTML of columns can be customized, by passing an array ofextraAttributes():
<div> element of each cell in that column.
Global settings
If you wish to change the default behaviour of all columns globally, then you can call the staticconfigureUsing() method inside a service provider’s boot() method, to which you pass a Closure to modify the columns using. For example, if you wish to make all columns sortable() and toggleable(), you can do it like so: