Using multiple icons in IconColumn #12330
Unanswered
juliangums
asked this question in
Help
Replies: 2 comments 3 replies
-
Maybe a custom column? Tables\Columns\ViewColumn::make('icons')
->view('custom-icons') <!-- resources/views/custom-icons.blade.php -->
<div class="flex">
@svg('heroicon-o-archive-box-arrow-down', 'w-7 h-7')
@svg('heroicon-o-archive-box-x-mark', 'w-7 h-7')
@svg('heroicon-o-archive-box', 'w-7 h-7')
</div> |
Beta Was this translation helpful? Give feedback.
2 replies
-
@juliangums if the state of the Tables\Columns\ImageColumn is an array or collection it will automatiaclly make multiple icons. The values of the state array have to be matched with the icon funtion (https://filamentphp.com/docs/3.x/tables/columns/icon) or if the state array contains the icon strings then you can use ->icon(fn (string $state): string => $state) instead of the match function. Tables\Columns\IconColumn::make('test')
->label('test icons')
->state(['draft', 'reviewing', 'reviewing', 'published'])
->icon(fn (string $state): string => match ($state) {
'draft' => 'heroicon-o-pencil',
'reviewing' => 'heroicon-o-clock',
'published' => 'heroicon-o-check-circle',
}), |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
For tables I love how you can use multiple images in ImageColumn and stack them. Is there any way to do the same with icons?
There is a method called wrap() in the docs mentioning that you should use it to wrap multiple icons so they don't overflow. But there is no mention of how to add multiple icons. I could find an icons() method but this just evaluates different closures and ultimately returns a single icon.
Does anyone know how to do this or how to easily use the work done for ImageColumn in a custom class for icons?
Beta Was this translation helpful? Give feedback.
All reactions