Skip to main content
You are currently viewing the documentation for Filament 4.x, which is a previous version of Filament.Looking for the current stable version? Visit the 5.x documentation.

Introduction

You may create your own custom column classes and views, which you can reuse across your project, and even release as a plugin to the community. To create a custom column class and view, you may use the following command:
This will create the following component class:
It will also create a view file at resources/views/filament/tables/columns/audio-player-column.blade.php.
Filament table columns are not Livewire components. Defining public properties and methods on a table column class will not make them accessible in the Blade view.

Adding a loading skeleton

When a table uses loadingSkeleton(), Filament adds the .fi-ta-content-loading class to the table content while its records are updating. You may use this class in your theme’s CSS to add a loading skeleton to a custom column. First, add a CSS hook class to the outer element of the column’s Blade view:
Then, style the column while it is inside the loading table content. The loading skeleton CSS variables ensure that your column uses the same animation, background color, and border radius as Filament’s built-in columns:
The pseudo-element uses the dimensions of your column’s existing content, so no additional skeleton HTML is required. You may adjust its inset, width, height, or border radius to match the shape of your column without changing the shared loading skeleton styles.

Accessing the state of the column in the Blade view

Inside the Blade view, you may access the state of the column using the $getState() function:

Accessing the Eloquent record in the Blade view

Inside the Blade view, you may access the current table row’s Eloquent record using the $record variable:

Accessing the current Livewire component instance in the Blade view

Inside the Blade view, you may access the current Livewire component instance using $this:

Accessing the current column instance in the Blade view

Inside the Blade view, you may access the current column instance using $column. You can call public methods on this object to access other information that may not be available in variables:

Adding a configuration method to a custom column class

You may add a public method to the custom column class that accepts a configuration value, stores it in a protected property, and returns it again from another public method:
Now, in the Blade view for the custom column, you may access the speed using the $getSpeed() function:
Any public method that you define on the custom column class can be accessed in the Blade view as a variable function in this way. To pass the configuration value to the custom column class, you may use the public method:

Allowing utility injection in a custom column configuration method

Utility injection is a powerful feature of Filament that allows users to configure a component using functions that can access various utilities. You can allow utility injection by ensuring that the parameter type and property type of the configuration allows the user to pass a Closure. In the getter method, you should pass the configuration value to the $this->evaluate() method, which will inject utilities into the user’s function if they pass one, or return the value if it is static:
Now, you can pass a static value or a function to the speed() method, and inject any utility as a parameter: