Skip to content

data-tip containing html? #2655

Closed Answered by saadeghi
longrunningprocess asked this question in Q&A
Discussion options

You must be logged in to vote

is there a clever way to achieve it I haven't tried?

There are 2 workaround for that:

https://play.tailwindcss.com/SnTQRTnJKr

<div
  data-tip="line1
line2"
  class="tooltip tooltip-open m-20 before:whitespace-pre-wrap"
>
  <button class="btn">a new line in data-tip</button>
</div>
<div data-tip class="tooltip tooltip-open m-20 before:whitespace-pre-wrap before:[--tw-content:'line1\aline2']">
  <button class="btn">using CSS</button>
</div>

Honestly this tooltip was designed to show a tiny, single line text, not a customizable content so there are limitations.

Another way is to use dropdown with hover: https://daisyui.com/components/dropdown/#open-on-hover

In the future I will provide bet…

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@mark1502
Comment options

@longrunningprocess
Comment options

Answer selected by saadeghi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants