Open bborgesr opened 7 years ago
In the meantime, I have a simple one that I've been using, it requires shinydashboard though for the bootstrap library
#' tooltipIcon, places text in hover over to guide users
#'
#' @param text text to include in tooltip
#' @param ... shiny objects to tooltip
#' @param link link location, or no link location if '#'
#' @param trigger what triggers the tooltip, see bootstrap documentation for more options
#' @param dataplacement where to place the tooltip relative to the icon, see bootstrap documentation
#'
#' @return a shiny object containing the given tooltip
#' @export
#'
#' @examples
#' # Required to load bootstrap library
#' library(shinydashboard)
#' tooltipIcon('This is text that will be shown on hover over', icon('question-circle'))
tooltipIcon <- function(text, ...,
link = '#',
trigger = 'focus hover',
dataplacement = "auto bottom") {
tags$a(
...,
href = link,
`data-toggle` = 'tooltip',
`data-placement` = dataplacement,
`data-trigger` = trigger,
title = text
)
}
you may get some ideas from ebailey78/shinyBS
The tooltip provided by shinyBS package breaks (does not show up) in many situations. A well tested tooltip function incorporated directly in shiny would be very helpful.
shinyBS isn't being maintained any more. I would recommend to avoid it as much as possible.
I agree that we should avoid shinyBS in the future. However, the features in shinyBS is really nice. I really want to see them incorporated in the shiny main package.
I used shinyBS:bsPopover to overcome this problem.
I know this thread is pretty old, but there is now a package bsplus we are gradually replacing shinyBS with.
This could be a question mark or another icon that shows a tooltip when you click or mouse over.