Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

virtualSelectInput hides element name when only one element for one group is present #680

Closed
le-raman opened this issue Mar 25, 2024 · 2 comments

Comments

@le-raman
Copy link

Hi devs,

Reporting following bug, with reproducible example:

library("shiny")

ui <- fluidPage(
  shiny::HTML("<br><br>"),
  shinyWidgets::virtualSelectInput(
    "test_id",
    "Label",
    list("A group" = c("An element of this group"))
  )
)

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

shinyApp(ui, server)

Result:

image

The element name itself is thus hidden; only the group name is shown. Using two elements, the behavior is ok, and both group name and elements are shown:

image

Any ideas how to circumvent this?

Thanks!

Lennart

@le-raman le-raman changed the title Material Switch hides element name when only one element for one group is present virtualSelectInput hides element name when only one element for one group is present Mar 25, 2024
@pvictor
Copy link
Member

pvictor commented Mar 26, 2024

Hello,
If there's only one element in a group you need to use a list rather than a vector, e.g. :

list("A group" = list("An element of this group"))

@le-raman
Copy link
Author

Thanks for the quick response. Can confirm that this work-around works.

@pvictor pvictor closed this as completed May 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants