Skip to content

Sticky Columns and Header

Inertia Table may keep the header row and any columns visible while users scroll a wide or tall table. Mark the header sticky with $stickyHeader = true, and pin individual columns with ->stickable() (user-toggleable) or ->sticky() (always pinned). The pin side (left or right) is auto-detected from the column's position, and adjacent sticky columns stack their offsets automatically.

To make the header sticky, set the $stickyHeader property to true on your Table class:

php
use InertiaUI\Table\Table;

class Users extends Table
{
    protected ?bool $stickyHeader = true;
}

To make the header sticky for every table, call the static defaultStickyHeader() method on the Table class, typically in your AppServiceProvider:

php
use InertiaUI\Table\Table;

Table::defaultStickyHeader();

Sticky Columns

To make a column stickable, pass the stickable argument to make() or call the stickable() method:

php
TextColumn::make('name', stickable: true);

TextColumn::make('name')->stickable();

To make every column stickable by default, call the static defaultStickable() method on the Column class, typically in your AppServiceProvider:

php
use InertiaUI\Table\Columns\Column;

Column::defaultStickable();

Sticky by Default v4

You may pin a column permanently by calling sticky(). The side (left or right) is auto-detected from the column's position in the visible columns: columns in the leading prefix pin to the left, columns in the trailing suffix pin to the right. This works for any column type, including ActionColumn.

php
ActionColumn::new()->sticky();

TextColumn::make('total')->sticky();

Multiple adjacent columns may be sticky on either side. Their offsets stack automatically:

php
public function columns(): array
{
    return [
        TextColumn::make('id'),
        TextColumn::make('name'),
        TextColumn::make('email'),
        BooleanColumn::make('is_admin')->sticky(),
        ActionColumn::new()->sticky(),
    ];
}

In the example above, is_admin and _actions are both pinned to the right edge of the table since they form a contiguous suffix of the visible columns.