Is possible to use Tooltip with html content?
I coudnt find anything in the docs abount html content inside tooltips.
4 Replies
new HtmlString(Value here)
If it doesn't work, build a custom view which doesn't sanitize the data.
I do similar with a custom popover column where we render markdown
new HtmlString(Value here) dosn't work.
I will try with a custom view.
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. hope this helps
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 ?? ['-']))), ]),