extraAttributes on Groups
Is it possible to give my group headings extraAttributes so I can give them some color? I'd like to have the description font be red for urgent.
->groups([
Group::make('priority')
->getDescriptionFromRecordUsing(fn (ToDo $record): string => match ($record->priority) {
'1. Urgent' => 'Needs to be done ASAP',
'2. Easy' => 'A fast task you can knock off your list',
'3. Short Term' => 'An ordinary task that can be done soon',
'4. Long Term' => 'Requires more planning, time and possibly resources',
default => 'Unknown priority', // Handle any other values
})
->titlePrefixedWithLabel(false),
])

Solution
In case anyone stumbles on this, the only way I was able to make it work was:
- custom theme
- In that theme I had to have a selector geared towards that specific text color that was rendering. I basically set classes using recordClasses and then in my theme css I had to have a very specific selector:
.task-urgent .text-gray-950 { @apply !text-red-600; }
The key was including that default gray text color.