F
Filament15mo ago
Ezrix

change background color for select column base on value

Is there any way i can make the select backgroud color change base on its value.. something like this 'Domain Pending' => 'red', 'Domain Locked' => 'purple', 'Domain Purchased' => 'indigo', 'Work In Progress' => 'amber', 'Done' => 'green', 'Cancel' => 'gray',
4 Replies
Meymink
Meymink15mo ago
Wouldn’t a livewire component with custom CSS where you change the color in its blade do the trick? Put variables in the CSS which is defined in the livewire component based on the value of the field.
ChesterS
ChesterS15mo ago
I don't think there's an 'easy' way, like the one you described, but you can add custom HTML to the options https://filamentphp.com/docs/3.x/forms/fields/select#allowing-html-in-the-option-labels
Ezrix
EzrixOP15mo ago
I don't think allowhtml will work on table . Let me try this .
Meymink
Meymink15mo ago
If this doesn’t work, you should give the HTML thing a try as you can put functions and variables in there. Matter fact, if that works i would prefer that over what I suggested.

Did you find this page helpful?