© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•2y ago•
1 reply
CADILAB

passing custom color

So i have something like this:

            ViewColumn::make('status')
                ->getStateUsing(function ($record) {
                    $status = ContractStatusEnum::tryFrom($record->status);
                    if ($status) {
                        return [
                            'label' => $status->getLabel(),
                            'color' => Color::hex($status->getColor()),
                            'icon' => $status->getIcon(),
                        ];
                    }
                    return [
                        'label' => '-',
                        'color' => null,
                        'icon' => null,
                    ];
                })
                ->view('filament.forms.components.contract-status-field'),
            ViewColumn::make('status')
                ->getStateUsing(function ($record) {
                    $status = ContractStatusEnum::tryFrom($record->status);
                    if ($status) {
                        return [
                            'label' => $status->getLabel(),
                            'color' => Color::hex($status->getColor()),
                            'icon' => $status->getIcon(),
                        ];
                    }
                    return [
                        'label' => '-',
                        'color' => null,
                        'icon' => null,
                    ];
                })
                ->view('filament.forms.components.contract-status-field'),


And custom view:

{{ $getState()['label'] }} <x-filament::icon-button
    icon="{{$getState()['icon']}}"
    color="{{ $getState()['color'] }}"
/>
{{ $getState()['label'] }} <x-filament::icon-button
    icon="{{$getState()['icon']}}"
    color="{{ $getState()['color'] }}"
/>


now the issue is, the color is hex, when i convert it and try to use with getState[color] i get the following error htmlspecialchars(): Argument #1 ($string) must be of type string, array given, i've tried unsafe render in laravel but still, am i missing something?
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

Custom page color
FilamentFFilament / ❓┊help
2y ago
custom component background color
FilamentFFilament / ❓┊help
9mo ago
Custom field button color
FilamentFFilament / ❓┊help
16mo ago
CUSTOM COLOR ON BADGE
FilamentFFilament / ❓┊help
2y ago