Displaying a description with HTML tag or entity on TextColumn
is there any way to add html entity or tag inside
->description()
on a table row?
i have tried as following:
Tables\Columns\TextColumn::make('status')
->description(fn (Tracking $record): string => \Carbon\Carbon::parse($record->date)->since() . ' ⋅ ' . $record->port->name)
7 Replies
in this case, do you really need the html
can you not just use the encoded version
Solution
⋅
if you're sure, wrap it in
new HtmlString()
but its really unnessecary
also be aware that you will open yourself up to XSS, so trust the port namei used the ⋅ (encoded version), just was curious to learn. Anyway, thanks for your suggestion about XSS. I am convinced to avoid to use HTML.
@Dan Harrin @KA Does v3 remove the html support in description method?
This is my code, it renders html as text:
your return type is wrong.
and please dont @ me
#✅┊rules
thank you, that works. Sorry for @ you, I didn't know that.