JohnCoene / tippy

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

Switch off tippy globally #15

Closed dmenne closed 3 years ago

dmenne commented 3 years ago

For advanced users, tooltips sometimes get into the way, so I usually provide a "Hide All Tooltips" checkbox. This can be done with CSS, but a simple documented function would be nice to have.

JohnCoene commented 3 years ago

I'm currently reworking the package as you might be able to tell. Things will change.

Right now this is what I would suggest: docs

library(shiny)
library(tippy)

ui <- fluidPage(
  useTippy(),
  h5("plot tooltip", class = "tip"),
  p("Another tooltip", class = "tip"),
  tippyThis(
    ".tip",
    "This is indeed a tooltip"
  ),
  actionButton("disable", "Disable"),
  actionButton("enable", "Enable")
)

server <- function(input, output) {
  observeEvent(input$disable, {
    tippy_disable()
  });

  observeEvent(input$enable, {
    tippy_enable()
  })
}

shinyApp(ui, server)

Any feedback is welcome.

dmenne commented 3 years ago

Perfect. Not yet in the docs, though