tippy icon indicating copy to clipboard operation
tippy copied to clipboard

Tippy + reactive

Open tonihaag opened this issue 3 years ago • 3 comments

In the newest package version, tippys are not reacting to changes in shiny inputs (specifically radio buttons) - I'm using tippyOutput and renderTippy ... they'll populate with data at the front end, but then as the inputs are changed which also changes a reactive, the tippy does not react

tonihaag avatar Mar 11 '21 17:03 tonihaag

version 0.0.1 works just fine - but version 0.1.0 does not work

tonihaag avatar Mar 11 '21 17:03 tonihaag

To be able to update tippy text, I am looking for something like the mentioned tippyOutput or similar, but could not find the documentation.

dmenne avatar Jul 15 '21 08:07 dmenne

I'm dealing with the same issue and have provided a MRE below to help solve this issue:

library(shiny)
library(tippy)

ui <- fluidPage(
  tags$br(),
  actionButton("btn", "update val"),
  tags$hr(),
  uiOutput("val_txt"),
  tags$br(),
  uiOutput("val_icon")
)

server <- function(input, output, session) {

  # val is reactive source for tooltip text
  val <- reactive({
    input$btn
    sample(letters, 1)
  })

  # Tooltip over text - works fine with reactive tooltip text
  output$val_txt <- renderUI({
    tippy(
      text = "Text",
      tooltip = val(),
      placement = "right"
    )
  })

  # Tooltip over UI - doesn't work with reactive tooltip text
  output$val_icon <- renderUI({
    with_tippy(
      element = icon("question-circle"),
      tooltip = val(),
      placement = "right"
    )
  })

}

shinyApp(ui, server)

Expected result: When you click the update val button, the letter displayed in the tooltip text should update in each element. This works for the text element with the tooltip rendered via tippy, but does not work for the UI element (an icon) with the tooltip rendered via with_tippy.

lanceupton avatar Dec 22 '21 21:12 lanceupton