0

I have a simple shinyDashbord app with a box that has a sidebar in it. I would like to add tooltip to the sidebar icon in the box header so that when I hover the mouse over the icon, the tooltip shows up. Is that possible?

# Toggle a box sidebar
library(shiny)
library(bs4Dash)

shinyApp(
  ui = dashboardPage(
    header = dashboardHeader(),
    body = dashboardBody(
      box(
        height = "500px",
        width = 12,
        maximizable = T,
        solidHeader = FALSE,
        collapsible = TRUE,
        sidebar = boxSidebar(
          id = "mycardsidebar",
          width = 30,
          p("Sidebar Content")
        ) 
      ),
    ),
    sidebar = dashboardSidebar()
  ),
  server = function(input, output, session) {
  }
)

Appreciate any help

Farhad
  • 151
  • 7

1 Answers1

1

There is concise documentation at https://github.com/RinteRface/bs4Dash/issues/267

# Toggle a box sidebar
library(shiny)
library(bs4Dash)

sidebar <- boxSidebar(
  id = "mycardsidebar",
  width = 30,
  p("Sidebar Content")
) 

sidebar[[1]]$attribs$`data-original-title` <- "Custom tooltip display"

shinyApp(
  ui = dashboardPage(
    help = TRUE,
    header = dashboardHeader(),
    body = dashboardBody(
      box(
        height = "500px",
        width = 12,
        maximizable = T,
        solidHeader = FALSE,
        collapsible = TRUE,
        sidebar = sidebar
      ),
    ),
    sidebar = dashboardSidebar()
  ),
  server = function(input, output, session) {
  }
)

tooltip example

Susan Switzer
  • 1,531
  • 8
  • 34