© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•17mo ago•
4 replies
F alko

Format state on empty column

I have table with width, height and length parameters.
When showing this in the table, I want to add a size column That shows width x height x length.

Tables\Columns\TextColumn::make('width')
    ->label('Size')
    ->formatStateUsing(fn($record) => sprintf(
        '%s x %s x %s mm',
        $record->width ?? '?',
        $record->height ?? '?',
        $record->length ?? '?',
    ),
),
Tables\Columns\TextColumn::make('width')
    ->label('Size')
    ->formatStateUsing(fn($record) => sprintf(
        '%s x %s x %s mm',
        $record->width ?? '?',
        $record->height ?? '?',
        $record->length ?? '?',
    ),
),

However, when one is null, I want to show
?
?
instead. When width is null, it doesn't hit the formatStateUsing method.

Is there a way to make a virtual column that is always resolved?
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

export format column
FilamentFFilament / ❓┊help
2y ago
Empty state on Dashboard Table Widget
FilamentFFilament / ❓┊help
2y ago
Empty initial state on list resource page?
FilamentFFilament / ❓┊help
3y ago
Format state of select filter
FilamentFFilament / ❓┊help
2y ago