RinteRface / shinydashboardPlus

extensions for shinydashboard
https://shinydashboardplus.rinterface.com
Other
449 stars 78 forks source link

strange interaction with shinyWidgets (dreamsR) #149

Open xtimbeau opened 2 years ago

xtimbeau commented 2 years ago

Here is a small reprex of a prettyToggle (really pretty btw) strange behavior when used with whinydashboardplus. As you can see toggling the prettytoggle is toggling the menu open/close icon on the right. It works correctly with shinydashboard, incorrectly with shinydashboardPlus.

library(shiny)
library(shinydashboard)
library(shinydashboardPlus)
library(shinyWidgets)

ui  <- dashboardPage(
  title= "a title",
  header=dashboardHeader(title= "a title"),
  sidebar=dashboardSidebar(
    width="360px",
    sidebarMenu(
      id = "tabs",
      menuItem("Buttons", tabName = "dashboard", icon = icon("dashboard"),
               prettyToggle(inputId="pretty_tgl_1", label_on="on", label_off="off")))),
  body=dashboardBody(
    box(
      title = textOutput("box_state"),
      id = "mybox",
      background = "maroon", 
      gradient = TRUE,
      collapsible = TRUE,
      closable = TRUE,
      textOutput("pretty_tgl_1"),
      width=12)))

server <- function(input, output, session) {

  observeEvent(input$pretty_tgl_1, {
    output$pretty_tgl_1 <- renderText(input$pretty_tgl_1)
  })
}

shinyApp(
    ui = ui,
    server = server
  )