Skip to content

Text Column

TextColumn is the most versatile and commonly used column type in Kinetics. It is used to display strings, numbers, dates, or even transform text into visual badges.

Use the static make() method with the attribute name from your database.

use Kinetics\Columns\TextColumn;
TextColumn::make('title')

You can access properties from Eloquent relationships using dot notation. For example, if your Post model has an author() relationship, and you want to display the author’s name:

TextColumn::make('author.name')->label('Author')

TextColumn is a prime candidate for the search (searchable()) and sort (sortable()) features.

TextColumn::make('title')
->sortable()
->searchable()

Kinetics provides built-in methods to easily format your created_at, updated_at, or any date columns without needing a custom format closure. It automatically uses Carbon behind the scenes.

Formats the column as a date. Default format is Y-m-d.

TextColumn::make('created_at')->date('d M Y') // Output: 17 Jun 2026

Formats the column as a time. Default format is H:i:s.

TextColumn::make('created_at')->time('H:i') // Output: 13:00

Formats the column as both date and time. Default format is Y-m-d H:i:s.

TextColumn::make('created_at')->dateTime('d M Y H:i')

Instead of creating a separate column type for statuses, you can transform any TextColumn into a Badge component natively.

Use the badge() method. You can also pass a boolean condition to dynamically decide if it should be rendered as a badge.

TextColumn::make('status')
->label('Order Status')
->badge()

The true power of badges lies in the color() method. It allows you to assign specific shadcn/ui color variants based on the row’s exact value.

Supported color variants: 'default', 'secondary', 'destructive', 'outline', 'ghost', 'link'.

Apply a single color to all badges in this column.

TextColumn::make('role')
->badge()
->color('secondary')

Pass an array to map specific column values to specific color variants. This is perfect for status columns!

TextColumn::make('status')
->badge()
->color([
'published' => 'default',
'draft' => 'secondary',
'deleted' => 'destructive',
])
MethodDescription
make(string $key)Creates a new column instance.
label(string $label)Sets the column header label.
as(string $outputKey)Sets an alias for the output key.
sortable(bool $value = true)Enables sorting for this column.
searchable(bool $value = true)Enables searching for this column.
hidden(bool $value = true)Hides the column from the table.
formatUsing(\Closure $cb)Customizes the output formatting via closure.
badge(bool $condition = true)Renders the column data as a badge.
color(string|array $color)Sets the badge color.
date(string $format)Formats the data as a date.
time(string $format)Formats the data as time.
dateTime(string $format)Formats the data as datetime.