JohnCoene / tippy

💬 Tippy.js for Shiny
http://tippy.john-coene.com/
Other
77 stars 2 forks source link

How to make tippy() tooltip popup bigger? #11

Closed rdatasculptor closed 3 years ago

rdatasculptor commented 3 years ago

If I understand correctly there is no way to control the height and width of the tippy() pop up box. Am I right or did I miss something?

Many thanks in advance!

JohnCoene commented 3 years ago

Not directly I believe, but since it supports HTML one can use any CSS.

tippy("<strong>Works with html!</strong>", 
  tooltip = "<div style='height:100px;'>I'm the tooltip!</div>",
)

Alternatively you could create a utility function and a class.

tippy_square <- function(text, content, ...){
  content <- sprintf("<div class='tp'>%s</div>", content)
  tippy(text, content, ...)
}

htmltools::browsable(
  htmltools::tagList(
    htmltools::tags$style(
      ".tp{
        height:200px;
        width:200px;
        text-align: center;
      }"
    ),
    tippy_square("Hover me", "Tooltip")
  )
)
rdatasculptor commented 3 years ago

yesss. Nice, good working solutions! thanks again John :)

rdatasculptor commented 3 years ago

I still run into a problem when there is a lot of text. The black background doesn't seem endless. When you add enought lines in the tooltip, you will see it seems actually a circle. Any ideas about how to make the black background bigger?