reactablefmtr icon indicating copy to clipboard operation
reactablefmtr copied to clipboard

pill_button tooltip

Open andresimi opened this issue 3 years ago • 6 comments

Hi, is there a way to configurate a text to display in the tooltip option of the pill_button function? Thank you!

andresimi avatar Jun 23 '22 17:06 andresimi

Hi, there isn't a way to currently do this but it's something I'm hoping to add at some point.

kcuilla avatar Jul 02 '22 00:07 kcuilla

2nd this. The tippy package is helpful with adding in tooltips (example below with color_scales), but yea, it would be great to also be able to this with pill_button (or color_tiles).

Great work with all the new docs. Really helpful.

library(htmltools)
library(dplyr)
library(tippy)
library(reactablefmtr)

data <- as_tibble(mtcars[1:6, ], rownames = "car") %>%
  select(car:hp)

reactable(
  data,
  columns = list(
    mpg = colDef(
      cell = function(value) {
        if (value == 21) 
          div(style = "text-decoration: underline; text-decoration-style: dotted; cursor: help",
            tippy(value, "test",
                  theme = "light-border"))
        else if (value == 22.8)
          div(style = "text-decoration: underline; text-decoration-style: dotted; cursor: help",
              tippy(value, "test2", theme = "translucent", duration = 1000, 
                    placement = "right", arrow = "round",
                    animation = "perspective"))
        else value
      },
      style = color_scales(data)
    )
  )
)

schmid07 avatar Jul 29 '22 00:07 schmid07

Thanks for providing this example, Bill. Increased options for the tooltip has been my number 1 most requested feature lately so it's been something I've been working on when I have time.

Wanted to mention thought that there is currently a tooltip for color_tiles and pill_buttons. It looks like I don't have an example of the tooltip in action on the package site but there is one for the color_tiles a couple examples down from the bottom here: https://kcuilla.github.io/reactablefmtr/articles/color_tiles.html#row-wise-styling

kcuilla avatar Aug 02 '22 02:08 kcuilla

Hey Kyle, thanks for the response and pointing out those examples. The thing I was looking to do was being able to add additional text and have a little more control over formatting of the tooltip.

Again, big thanks for all the work you've put into everything. I've really enjoyed using it.

schmid07 avatar Aug 02 '22 14:08 schmid07

I've been making good progress on this and hoping to have something released next week. The new tooltip will include additional styling options (themes, CSS styles), the ability to include additional text/values from other columns, and how the tooltip can be called (hover or click).

Once it's been added to the package, I'll let you know, and would love to hear some feedback on it!

kcuilla avatar Aug 10 '22 12:08 kcuilla

I just made some updates to tooltip() in dev. You can now style the tooltip and display data from other columns. The changes have been applied to the standalone tooltip() only so far but they will soon be added to pill_buttons(), color_tiles(), etc.

image

image

kcuilla avatar Aug 19 '22 20:08 kcuilla