I'm writing a code for my shinyApp (using golem package and modules - not sure if it is important). I'm stack with tooltips for the button that does not appear in my app but works perfectly in the app I've tried to create as reprex. I can not find where this problem comes from. Perhaps it is something wrong with the module communication.
Here is my attempt to make a reprex (which is obviously not a reprex). Briefly, mod_body_...
creates a box for the dashboardPage()
. Box contains a shinyWidgets::actionBttn()
. As it does not have a tooltip option, I used shinyBS::tipify()
to add a tooltip. Here it works just fine, but when I copy-paste it into my app, it returns the button but without tooltip. I also tried to tipify the other objects at the same and different tab, still tooltip is lost somewhere on the way.
Does anyone have an idea what went wrong?
library(shiny)
library(shinyBS)
library(shinyWidgets)
mod_body_ui <- function(id){
ns <- NS(id)
tab_item <- shinydashboard::tabItem(
tabName = "test_tab",
fluidRow(
shinydashboardPlus::box(
title = "Test box",
width = 4,
collapsible = TRUE,
icon = shiny::icon("plus"),
htmlOutput(outputId = ns("bttns"))
)
)
)
return(tab_item)
}
mod_body_server <- function(id){
moduleServer( id, function(input, output, session){
ns <- session$ns
output$bttns <- renderUI({
btn_remove <- shinyBS::tipify(
shinyWidgets::actionBttn(
inputId = ns("remove_selected"),
label = shiny::icon("minus"),
style = "material-flat",
size = "sm"
),
title = "Remove selected from the library",
placement = "right"
)
return(btn_remove)
})
})
}
ui <- function(request) {
tagList(
shinydashboardPlus::dashboardPage(
title = "Test",
md = FALSE,
scrollToTop = TRUE,
header = shinydashboardPlus::dashboardHeader(title = "Header"),
sidebar = shinydashboardPlus::dashboardSidebar(
shinydashboard::menuItem(text = "Test",
tabName = "test_tab")
),
body = shinydashboard::dashboardBody(
id = "body",
shinydashboard::tabItems(
mod_body_ui("body_ui")
)
)
)
)
}
server <- function(input, output, session) {
mod_body_server("body_ui")
}
shinyApp(ui, server)
The structure of my app is roughly as follows:
UI/Server (define dashbosrdPage):
module header
module sidebar
module body
module tab1
module tab2
module box1
module box2