F
Filament10mo ago
Noor

Table column badge

In status badge is there any way to put badges color without hard coding status name , also any option to put color picker so the user can choose whatever color to use for their status.
2 Replies
Noor
NoorOP10mo ago
any help !?
awcodes
awcodes10mo ago
I believe color accepts a callback so you could do something like
->color(fn($record) => $record->status->color)
->color(fn($record) => $record->status->color)
This obviously depends on how the color is stored but should work. So if the color is a hex value and not a preset color registered with Filament you would want to return a Filament Color object. Like Color::hex($record->status->color) As for the user being able to set it you would have store that as a setting somewhere else and call it in the method.
Want results from more Discord servers?
Add your server