© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•16mo ago•
8 replies
Djomla

Table Filter Custom Option Html

Hi all,

In my resource $table, I want to have custom html in one of my select filters.

            ->filters([
                Tables\Filters\SelectFilter::make('sport_id')
                    ->options(function () {
                        $sports = Sport::all();

                        return $sports->mapWithKeys(function ($sport) {
                            $imageUrl = url('/storage/' . $sport->image);
                            $optionLabel = "<span class='filter-option'>
                                <img src='{$imageUrl}' alt='{$sport->name}' class='sport-icon'>
                                {$sport->name}
                            </span>";
                            return [$sport->id => $optionLabel];
                        })->toArray();
                    })
                    ->searchable()
                    ->label('Sport'),
            ->filters([
                Tables\Filters\SelectFilter::make('sport_id')
                    ->options(function () {
                        $sports = Sport::all();

                        return $sports->mapWithKeys(function ($sport) {
                            $imageUrl = url('/storage/' . $sport->image);
                            $optionLabel = "<span class='filter-option'>
                                <img src='{$imageUrl}' alt='{$sport->name}' class='sport-icon'>
                                {$sport->name}
                            </span>";
                            return [$sport->id => $optionLabel];
                        })->toArray();
                    })
                    ->searchable()
                    ->label('Sport'),


But Im getting raw HTML as result.
image.png
Solution
Actually:

https://github.com/filamentphp/filament/pull/14228
GitHub
Htmlable Select Filter by CodeWithDennis · Pull Request #14228 · fi...
Description
The SelectFilter didn&#39;t support the -&gt;allowHtml() method, even though the Select:: form component does. This PR fixes that issue.
Visual changes


Functional changes

Co...
Htmlable Select Filter by CodeWithDennis · Pull Request #14228 · fi...
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
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

Custom Table Filter
FilamentFFilament / ❓┊help
5mo ago
Custom Filter Table
FilamentFFilament / ❓┊help
3y ago
Table custom filter validate
FilamentFFilament / ❓┊help
2y ago
Filter option
FilamentFFilament / ❓┊help
3y ago