A to include tooltips in Shiny apps and
Stable release.
Or the version.
# install.packages("remotes")
remotes::install_github("JohnCoene/tippy")
remotes::install_bitbucket("JohnCoene/tippy")In .
tippy("<strong>Works with html!</strong>",
tooltip = "<strong>Hi</strong>, I'm the tooltip!",
allowHTML = TRUE,
animation = "scale",
duration = 1000,
placement = "bottom",
theme = "light"
)You can also use in
, tippy("like this", "Here's the tooltip").
Works in Shiny apps, you can apply the tooltip to another element with with_tippy.
library(shiny)
library(tippy)
shinyApp(
ui = fluidPage(
with_tippy(
textInput('text', 'Text'),
tooltip = "TEXT"
),
with_tippy(
selectInput('select', 'Select', c('a', 'b')),
"SELECT"
),
with_tippy(
numericInput('numeric', 'Numeric', NULL),
"NUMERIC"
),
with_tippy(
radioButtons('radio', 'Radio', c('a', 'b')),
"RADIO"
),
with_tippy(
checkboxInput('check', 'Check'),
"CHECKBOX"
),
with_tippy(
actionButton('action', 'Action'),
"BUTTON"
),
with_tippy(
sliderInput('slider', 'Slider', 0, 1, 0.5),
"SLIDER"
),
with_tippy(
dateInput('date', 'Date'),
"DATE"
)
),
server = function(input, output) {}
)You can also
call tippy on
at once with tippy_class
library(shiny)
shinyApp(
ui = fluidPage(
fluidRow(
column(
3,
h3("Same tooltip"),
p("Some text", class = "tip"),
p("Some text", class = "tip"),
p("Some text", class = "tip"),
p("Some text", class = "tip"),
p("Some text", class = "tip"),
p("Some text", class = "tip"),
tippy_class("tip", content = "Tooltip")
),
column(
3,
h3("Different tooltips"),
p("Some text", class = "tip2", `data-tippy-content` = "Tooltip 1"),
p("Some text", class = "tip2", `data-tippy-content` = "Tooltip 2"),
p("Some text", class = "tip2", `data-tippy-content` = "Tooltip 3"),
tippy_class("tip2")
)
)
),
server = function(input, output, session) {}
)You must pass session to your server function for it to work!