Β© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filamentβ€’3y agoβ€’
6 replies
tommy_jeanslow

JSON TextColumn formatStateUsing badge repeats

I am trying to show a badge for my JSON column. Everything works properly, but it repeats based on how many entries I have.

I tried using limitList() however it will say "and X more".

Tables\Columns\TextColumn::make('attachments')
                    ->formatStateUsing(fn ($state) => $state != null ? 'Attachment' : "")
                    ->badge(),
Tables\Columns\TextColumn::make('attachments')
                    ->formatStateUsing(fn ($state) => $state != null ? 'Attachment' : "")
                    ->badge(),


Any help is appreciated πŸ™‚
Solution
->state(fn ($record): string => $record->attachments ? 'Attachments' : '')
->badge()
->state(fn ($record): string => $record->attachments ? 'Attachments' : '')
->badge()

?
Jump to solution
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

Multicolor TextColumn Badge
FilamentFFilament / β“β”Šhelp
13mo ago
TextColumn->icon() disabled by formatStateUsing()
FilamentFFilament / β“β”Šhelp
3y ago
Translate labels in TextColumn->badge()
FilamentFFilament / β“β”Šhelp
3y ago
Can't I give default in TextColumn formatStateUsing?
FilamentFFilament / β“β”Šhelp
2y ago