dreamRs / shinyWidgets

shinyWidgets : Extend widgets available in shiny
https://dreamrs.github.io/shinyWidgets/
GNU General Public License v3.0
832 stars 153 forks source link

description not showing in `virtualSelectInput` #564

Closed ocelhay closed 1 year ago

ocelhay commented 1 year ago

Thanks for your fantastic package!

I was expecting that a description would show in the virtualSelectInput but it's not the case. Any idea?

SCR-20230109-ewg
library(shiny)

ui <- fluidPage(

  shinyWidgets::virtualSelectInput(
    "progression_facet_row",
    "Facet by:",
    choices = shinyWidgets::prepare_choices(
      tibble::tibble(
        label = c("None", "Site", "Race/ethnicity", "Household Income", "Education Household", "Education Primary Caregiver"),
        value = c("none", "site", "race_ethnicity", "income_household", "education_household", "education_primcg"),
        description = c("", "", rep("Pediatric / Pediatric and Caregiver only", 4))
      ),
      label = label,
      value = value,
      description = description
    ),
    selected = "none",
    multiple = FALSE
  )
)

server <- function(input, output) {}

shinyApp(ui = ui, server = server)
pvictor commented 1 year ago

Currently you have to explicitly set virtualSelectInput(..., hasOptionDescription = TRUE) to display description text under choices labels. In future, maybe we can automate that if choices are made with prepare_choices() and have a description.

ocelhay commented 1 year ago

Thanks! I think that would make sense to automate this if you have a chance.