Skip to main content

Introduction

Text columns display simple text based on the column’s state:
use Filament\Tables\Columns\TextColumn;

TextColumn::make('title')

Formatting the text

Date formatting

You can format date values using the date(), dateTime(), and time() methods:
TextColumn::make('created_at')
    ->date()
You may customize the format by passing a custom format string:
TextColumn::make('created_at')
    ->date('M j, Y')
format
string
The PHP date format string.

Number formatting

You can format a column as a number using numeric():
TextColumn::make('stock')
    ->numeric()
decimalPlaces
int
default:"0"
The number of decimal places.
locale
string
default:"app locale"
The locale for number formatting.

Money formatting

You can easily format money values:
TextColumn::make('price')
    ->money('EUR')
currency
string
required
The currency code (e.g., ‘EUR’, ‘USD’).
divideBy
int
default:"1"
Divide the value before formatting (useful for cents).

Customizing the appearance

Color

You may set a color for the text:
TextColumn::make('status')
    ->color('primary')
You can also use a closure to dynamically determine the color:
TextColumn::make('status')
    ->color(fn (string $state): string => match ($state) {
        'draft' => 'gray',
        'reviewing' => 'warning',
        'published' => 'success',
        'rejected' => 'danger',
    })
color
string | Closure
The color name or a closure that returns a color.

Displaying as a badge

You can display text as a badge:
TextColumn::make('status')
    ->badge()
    ->color(fn (string $state): string => match ($state) {
        'draft' => 'gray',
        'reviewing' => 'warning',
        'published' => 'success',
    })
condition
bool | Closure
default:"true"
Whether to display as a badge.

Adding an icon

Text columns may have an icon:
use Filament\Support\Icons\Heroicon;

TextColumn::make('email')
    ->icon(Heroicon::Envelope)
icon
string | BackedEnum | Htmlable | Closure
The icon to display.
iconPosition
IconPosition | Closure
default:"IconPosition::Before"
The position of the icon (Before or After).
iconColor
string | array | Closure
The color of the icon.

Text size

You can customize the text size:
use Filament\Support\Enums\TextSize;

TextColumn::make('title')
    ->size(TextSize::Large)
Available sizes: ExtraSmall, Small, Medium, Large.
size
TextSize | string | Closure
The text size.

Font weight

Customize the font weight:
use Filament\Support\Enums\FontWeight;

TextColumn::make('title')
    ->weight(FontWeight::Bold)
Available weights: Thin, ExtraLight, Light, Medium, SemiBold, Bold, ExtraBold, Black.
weight
FontWeight | string | Closure
The font weight.

Font family

You can change the font family:
use Filament\Support\Enums\FontFamily;

TextColumn::make('email')
    ->fontFamily(FontFamily::Mono)
Available families: Sans, Serif, Mono.
fontFamily
FontFamily | string | Closure
The font family.

Working with lists

Listing multiple values

If your column state is an array, values will be comma-separated by default. You can display them on separate lines:
TextColumn::make('authors.name')
    ->listWithLineBreaks()
condition
bool | Closure
default:"true"
Whether to display list items on separate lines.

Adding bullet points

You can add bullet points to list items:
TextColumn::make('authors.name')
    ->bulleted()

Limiting the list

Limit the number of values displayed:
TextColumn::make('authors.name')
    ->listWithLineBreaks()
    ->limitList(3)
limit
int | Closure
default:"3"
The maximum number of items to display.
You can make the limited list expandable:
TextColumn::make('authors.name')
    ->listWithLineBreaks()
    ->limitList(3)
    ->expandableLimitedList()

Handling long text

Limiting text length

Limit the number of characters:
TextColumn::make('description')
    ->limit(50)
limit
int | Closure
The maximum number of characters.
end
string | Closure
default:"'...'"
The string to append when text is truncated.

Limiting word count

Limit the number of words:
TextColumn::make('description')
    ->words(10)
words
int | Closure
The maximum number of words.

Wrapping text

By default, text will not wrap. Enable wrapping:
TextColumn::make('description')
    ->wrap()

Line clamping

Limit text to a specific number of lines:
TextColumn::make('description')
    ->wrap()
    ->lineClamp(2)
lineClamp
int | Closure
The maximum number of lines to display.

Making text copyable

Allow users to copy text to clipboard:
TextColumn::make('email')
    ->copyable()
    ->copyMessage('Email address copied')
    ->copyMessageDuration(1500)
condition
bool | Closure
default:"true"
Whether the text should be copyable.
message
string | Closure
default:"'Copied'"
The message to display when copied.
duration
int | Closure
default:"2000"
How long to show the message (milliseconds).

Additional methods

Row index

Display the row index:
TextColumn::make('index')
    ->rowIndex()
isFromZero
bool
default:"false"
Whether to start counting from zero.

Description

Add a description below the column content:
TextColumn::make('title')
    ->description(fn (Post $record): string => $record->description)
description
string | Htmlable | Closure
The description text.
position
string
default:"'below'"
Position of the description (‘above’ or ‘below’).

Build docs developers (and LLMs) love