tippy
tippy copied to clipboard
Tippy + reactive
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
version 0.0.1 works just fine - but version 0.1.0 does not work
To be able to update tippy text, I am looking for something like the mentioned tippyOutput or similar, but could not find the documentation.
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
.