shinyWidgets
shinyWidgets copied to clipboard
pickerInput not working as expected when used w/ semantic.dashboard
Let me start by saying that shinyWidgets is a great R package.
I also wanted to inquire about possible solution(s) for the following issues encountered when using pickerInput in combination with semantic.dashboard:
- visual output in UI, created using pickerInput, is not a dropdown menu
- when clicking on the visual output the entire list of options (passed as input to pickerInput ) shows up in UI, and cannot be closed
See snapshot of UI as Shiny app starts ,
and then a second snapshot when clicking on the box containing the value to select
Here is the code used to create this dashboard
`if(interactive()){
ui <- semantic.dashboard::dashboardPage(
header = semantic.dashboard::dashboardHeader(
color = "blue",
title = "Dashboard Test",
inverted = TRUE
),
sidebar = semantic.dashboard::dashboardSidebar(
size = "thin",
color = "teal",
semantic.dashboard::sidebarMenu(
semantic.dashboard::menuItem(
tabName = "tabID_main",
"Main Tab"),
semantic.dashboard:: menuItem(
tabName = "tabID_extra",
"Extra Tab")
)
),
body = semantic.dashboard::dashboardBody(
semantic.dashboard::tabItems(
selected = 1,
semantic.dashboard::tabItem(
tabName = "tabID_main",
semantic.dashboard::box(
shiny::h1("Main body"),
title = "A b c",
width = 16,
color = "orange",
shinyWidgets::pickerInput(
inputId = "ID_One",
choices = c("Value One","Value Two","Value Three"),
label = shiny::h5("Value to select"),
selected = "Value Two",
width = "fit",
inline = TRUE),
shiny::verbatimTextOutput(outputId = "res_One")
)
),
semantic.dashboard::tabItem(
tabName = "tabID_extra",
shiny::h1("extra")
)
)
)
)
server <- function(input, output, session) { output$res_One <- shiny::renderPrint(input$ID_One) }
shiny::shinyApp(ui, server)
}
`
I am using
- R version 3.6.3 64-bit on Windows computer
- R packages as of checkpoint date 2021-05-15
- shinyWidget version 0.6.0
- semantic.dashboard version 0.2.0
Hello,
That's because pickerInput()
needs Bootstrap to work properly, and semantic.dashboard doesn't use Bootstrap like normal shiny applications.
An alternative can be to use virtualSelectInput widget which have similar functionalities (or even more) and comes with no framework dependencies (bootstrap, semantic, ...)
Victor