Overview

Table Columns
Watch the Rapid Laravel Development with Filament series on Laracasts - it will teach you the basics of adding columns to Filament resource tables.Filament\Tables\Columns namespace. You can put them inside the $table->columns() method:
make() method, passing its unique name. The name of the column should correspond to a column or accessor on your model. You may use “dot notation” 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:
Sorting by default
You may choose to sort a table by default if no other sort is applied. You can use thedefaultSort() method for this:
Persist sort in session
To persist the sorting in the user’s session, use thepersistSortInSession() method:
Setting a default sort option label
To set a default sort option label, use thedefaultSortOptionLabel() method:
Searching
Columns may be searchable by using the text input field 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:
Customizing the table search field placeholder
You may customize the placeholder in the search field using thesearchPlaceholder() method on the $table:
Searching individually
You can choose to enable a per-column search input field using theisIndividual parameter:
isIndividual parameter, you may still search that column using the main “global” search input field for the entire table.
To disable that functionality while still preserving the individual search functionality, you need the isGlobal parameter:
Customizing the table search debounce
You may customize the debounce time in all table search fields using thesearchDebounce() method on the $table. By default it is set to 500ms:
Searching when the input is blurred
Instead of automatically reloading the table contents while the user is typing their search, which is affected by the debounce of the search field, you may change the behavior so that the table is only searched when the user blurs the input (tabs or clicks out of it), using thesearchOnBlur() method:
Persist search in session
To persist the table or individual column search in the user’s session, use thepersistSearchInSession() or persistColumnSearchInSession() method:
Column 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 behavior 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 columns with an empty state, you may use thedefault() method. This method will treat the default state as if it were real, so columns like image or color will display the default image or color.
Adding placeholder text if a column is empty
Sometimes you may want to display placeholder text for columns with an empty state, which is styled as a lighter gray text. This differs from the default value, as the placeholder is always text and not treated as if it were real state.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:
Making toggleable columns hidden by default
By default, toggleable columns are visible. To make them hidden instead:Customizing the toggle columns dropdown trigger action
To customize the toggle dropdown trigger button, you may use thetoggleColumnsTriggerAction() method, passing a closure that returns an action. All methods that are available to customize action trigger buttons can be used:
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 thestate() method, you can customize the returned state for that column based on the $record:
Tooltips
You may specify a tooltip to display when you hover over a cell:Horizontally aligning column content
Table columns are aligned to the start (left in LTR interfaces or right in RTL interfaces) by default. You may change the alignment using thealignment() method, and passing it Alignment::Start, Alignment::Center, Alignment::End or Alignment::Justify options:
alignEnd():
Vertically aligning column content
Table column content is vertically centered by default. You may change the vertical alignment using theverticalAlignment() method, and passing it VerticalAlignment::Start, VerticalAlignment::Center or VerticalAlignment::End options:
verticallyAlignStart():
Allowing column headers to wrap
By default, column headers will not wrap onto multiple lines, if they need more space. You may allow them to wrap using thewrapHeader() method:
Controlling the width of columns
By default, columns will take up as much space as they need. You may allow some columns to consume more space than others by using thegrow() method:
style attribute, so you can use any valid CSS value:
Grouping columns
You group multiple columns together underneath a single heading using aColumnGroup object:
ColumnGroup object. To improve the multi-line fluency of the API, you can chain the columns() onto the object instead of passing it as the second argument:
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 behavior 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 searchable() and toggleable(), you can do it like so: