F
Filament4mo ago
jjo63

->description() - is it possible to further style?

Table columns and using the ->description() method (correct term?) for example like this
Tables\Columns\TextColumn::make('name')
->label('Filename')
->description('my description')
->sortable(),
Tables\Columns\TextColumn::make('name')
->label('Filename')
->description('my description')
->sortable(),
Is it possible to apply styling to the description (such as badge and setting a colour)? I don't think that description() supports this natively and am sure that there is a method to further style using some kind of custom code but wouldn't know where to start on this. Any pointers? thx j
4 Replies
Dennis Koch
Dennis Koch4mo ago
You probably can use ->description(new HtmlString('your_html')) and return some HTML
jjo63
jjo63OP4mo ago
Thanks I'll take a look at that approach.
bernhard
bernhard4mo ago
Dennis Koch already mentioned new HtmlString. As an alternative you can also use your own view where you can use blade components, etc.
->description(fn($record) => view("path.to.your.view", ["record" => $record]))
->description(fn($record) => view("path.to.your.view", ["record" => $record]))
Dennis Koch
Dennis Koch4mo ago
That might be even cleaner.
Want results from more Discord servers?
Add your server