JohnCoene / tippy

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

height and width not working #1

Closed markgrujic closed 3 years ago

markgrujic commented 5 years ago

Hi, Thanks for the work on this package, it's really great!

I'm trying to set the height and width of the tooltip so that it encompasses all the content. The width of the tooltip seems to be determined based off the height of the tooltip that fits the content at "100%"

library(shiny)
library(tippy)
shinyApp(
  ui = fluidPage(
    tippy(text = "<b>Text</b>",
          allowHTML = T,
          interactive = T,
          tooltip = paste(img(src="http://tippy.john-coene.com/logo.png",
                              height="150%", width = "150%")),
          placement = "right",
          arrow = T,
          height = '600px', width = '600px' # this doesn't appear to do anything
    )
  ),
  server = function(input, output) {}
)

Running that snippet, you can see that the tooltip height is good but the width is short. Changing the height and width arguments inside the img() function to 100% fix the out-of-tooltip issue, but the tooltip is a fixed size and the image is forced to be that size.

Is there a way to change the size of the tooltip? The size argument doesn't seem to work either, however it does something: tippysize

Cheers

JohnCoene commented 5 years ago

Thanks for reporting that.

I just updated the package to version 3.2.0. The arguments width and height never did anything, I should have removed them earlier on. The issue comes from changing the width of the original image. In the new version at least, the code below works.

library(shiny)
library(tippy)

shinyApp(
  ui = fluidPage(
    tippy(text = "<b>Text</b>",
          allowHTML = TRUE,
          interactive = TRUE,
          tooltip = paste(img(src="http://tippy.john-coene.com/logo.png")),
          placement = "right",
          arrow = TRUE,
          theme = "light"
    )
  ),
  server = function(input, output) {}
)
markgrujic commented 5 years ago

Great! The size is now working perfectly. Super minor point, but the tooltip margin doesn't encompass the content.

image

Thanks for the updates

JohnCoene commented 3 years ago

This is now doable on the latest version, sorry it took so long to fix.

library(shiny)
library(tippy)

shinyApp(
  ui = fluidPage(
    tippy("<b>Text</b>",
          allowHTML = T,
          interactive = T,
          content = paste(
            img(
              src="http://tippy.john-coene.com/logo.png",
              height="200px", 
            )
          ),
          placement = "right",
          arrow = T,
          maxWidth = 600 # this doesn't appear to do anything
    )
  ),
  server = function(input, output) {}
)