tables can be easily configured in the backend. You can easily display attributes, relationships or include your own Vue components to adjust the table as needed. The following explains how to customize the tables to your needs.

Column Value


Casual text columns are added with the function col($label). Attached are all methods for configuring the column.


The value of the column is indicated by the function value. You can specify model attributes in curly brackets to include them in the text flow.

$table->col('Name')->value('{first_name} {last_name}');

Display Relationship Attributes

It is also possible to display the attribute of relationships. In this case attributes must be separated with a dot like this:


Display Options

Maybe you want to display a value representative for a state, this can be achived by passing the attribute name as the first and an array of options as the second parameter to the value method:

use App\Models\Product;

$table->col('State')->value('state', [
    Product::AVAILABLE    => 'available',
    Product::OUT_OF_STOCK => 'out of stock',

Text Alignment

You may set the text align to right like shown in the following examples:

$table->col('amount')->value('{amount} €')->right();

Strip Html

For example, if you want to display the value of a wysiwyg field, it makes sense to strip the html tags and specify a maximum number of characters like this:



Perform a regular expression search and replace:

    ->regex('/\b(\w*orange\w*)\b/im', 'apple'); // Replaces orange with apple.


Let's assume that you want to display an amount of money in a column. For this the money method with the desired attribute can be used. The amount is formatted and the column can be sorted by the attribute.



For formatting the formatCurrnency method of the PHP NumberFormatter is used. This makes it possible to choose the 3-letter ISO 4217 currency code. The default currency code is EUR.

$table->money('amount', 'USD');

Additionally, the language can be specified as a third parameter. However, the locale of the authenticated user is used by default.

$table->money('amount', 'USD', 'en_US');

Usefull ISO 4217 codes:

Code Currency Example (de_DE)
"EUR" Euro "10,00 €"
"USD" US Dollar "10,00 $"
"AUD" Australian Dollar "10,00 AU$"
"CHF" Swiss Franc "10,00 CHF"
"GGP" Pound "10,00 £"


To display a formatted date, you may use the date method. A parameter with the desired formatting is required.

$table->date('created_at', 'Y-m-d');

Reduce Width

With the function small the column is reduced to the minimum width.



A table column can be sorted directly by clicking on the column in the table head. To achieve this, you simply have to specify the name of the attribute you want to sort by.

$table->col('Name')->value('{first_name} {last_name}')->sortBy('first_name');

You may even sort by related column.


In case of long loading times when sorted by relation attributes it can help to add an index on the column that connects the relation.

Form Fields

In litstack form fields can be placed in table columns, this allows the user to edit attributes directly in the table similar to excel. Each column can contain only one form field.



You may make actions available directly in a table column:

use Lit\Actions\SendMailAction;

$table->action('Send Mail', SendMailAction::class)->label('Mail');

Multiple Actions

You can also place multiple actions in one column. These are then accessible via a dropdown button

use Lit\Actions\FooAction;
use Lit\Actions\BarAction;

    'Foo' => FooAction::class,
    'Bar' => BarAction::class,


If an image is to be displayed in a table, the image url must also be specified using the src method. If the image was uploaded via the Image Field, the conversions specified in the config file lit.php can be displayed.


Display media conversion for images that where uploaded via the Image field.

Example: $column->src('{}')


You may use avatar to display a rounded image.


maxWidth, maxHeight

Furthermore, a maxWidth and a maxHeight can be defined.



Set a width and a height if the image should simply be displayed as a square:

    ->square('50px'); // Displays the image as 50 x 50 px square using object-fit: cover


Often you want to display the progress of a model directly in a table column. Litstack provides the progress column for this purpose:

$table->progress('value', $max = 100)->label('Progress');


In some cases, you may want to link a relation directly in your table. This can be achieved by using the relation method. The related name of the relation and the related crud config must be specified.

use Ignite\Support\Facades\Config;
use Lit\Config\Crud\ProductConfig;

$table->relation('product', ProductConfig::class)
    ->value('{}') // Related attribute to be displayed.


To edit the boolean state of a moel directly in a table, a switch can be displayed in a column using toggle. The name of the corresponding attribute must be specified as the first parameter. In addition, the routePrefix for the update route must be specified, if the table is built in a CRUD or form config, simply use the config function routePrefix.


Blade View

With the view method you can easily add Blade Views to your table column:

<div class="badge badge-secondary">
    Hello World!

Vue in Blade components

You can use Vue components in your blade component:

    Hello World!

Use the prop item to display model attributes:

<b-badge v-html="item.state" />

Vue Component

You can also integrate your own Vue components into columns. The component name is specified as the first parameter, the label must be specified separately. Additionally props can be defined.

    ->prop('variants' => [
        'active' => 'success',
        'complete' => 'primary',
        'failed' => 'danger'

Your component could look like this:

    <b-badge :variant="variants[item.state]">
        {{ item.state }}
export default {
    name: 'MyTableComponent',
    props: {
        item: {
            required: true,
            type: Object
        vairants: {
            type: Array,
            required: true

Read the Extend Vue section to learn how to register your own Vue components.

Why don't you do us a favor by leaving a little star on GitHub