user51462
user51462

Reputation: 2072

R Shiny - customisation options not working for tippy::with_tippy()

I am trying to position a tooltip to the right of a textInput using the tippy package, however, it isn't working:

library(shiny)
library(tippy)

shinyApp(
  ui = fluidPage(
    with_tippy(textInput("input", "input with tooltip"), "Input text", placement = "right")
 ),
 server = function(input, output) {}
)

The position = 'right', arrow = 'true' and theme = 'light' options also don't seem to be working.

I was wondering if this was a browser compatibility issue or if I'm missing some CSS dependencies on my end? I have tried running the app on Chrome v82.0.4068.5, Firefox 73.0.1 and Microsoft Edge 44.18362.449.0 to no avail.

Upvotes: 1

Views: 560

Answers (1)

TTS
TTS

Reputation: 1928

Your code doesn't run because with_tippy is not a valid function.

The code below should properly show the position of the tooltip. Important to note: the tippy_this(elementId) refers back to the textInput(inputId) named THISinput here for clarity.

Instead of actually wrapping the textInput in the tippy_this, we just refer back to the input with elementId.

library(shiny)
library(tippy)

shinyApp(
  ui = fluidPage(
    textInput(inputId = "THISinput", "input with tooltip"),
    tippy_this(elementId = "THISinput", tooltip = "Hovertext for 'THISinput' here", placement="right")
  ),
  server = function(input, output) {}
)

Upvotes: 1

Related Questions