HTML in tooltip for table columns
Is there a reason why some tooltips support HTML and other don't?
I need some line breaks in there, and thought nl2br would be my best bet..
2 Replies
Can you share the code you've been trying?
forwhoever needed this, below method works for me. it is not working when doing x-tooltip.html or x-tooltip.raw alone. But somehow defined an empty x-tooltip.html will make the raw works with html.
TextColumn::make('name')
->html()
->extraAttributes(fn (Model $record): Array => [ 'x-tooltip.html' => new HtmlString(), 'x-tooltip.raw' => new HtmlString(implode('<br>- ', ($record->whatever ?? ['-']))), ]),
->extraAttributes(fn (Model $record): Array => [ 'x-tooltip.html' => new HtmlString(), 'x-tooltip.raw' => new HtmlString(implode('<br>- ', ($record->whatever ?? ['-']))), ]),