Replies: 1 comment 1 reply
-
Here's a quick example to make the select look like a Bootstrap's button, it require some CSS and it's not perfect (you have to click the middle of the button): library(shiny)
library(shinyvs)
ui <- fluidPage(
tags$h2("Virtual Select"),
tags$style(
".vscomp-toggle-button {border: none !important; padding: 0 !important; background-color: transparent !important;}",
".vscomp-wrapper.focused .vscomp-toggle-button, .vscomp-wrapper:focus .vscomp-toggle-button {box-shadow: none !important;}"
),
virtualSelectInput(
inputId = "single",
label = "Single select:",
choices = month.name,
search = TRUE,
placeholder = "Sélectionner",
searchPlaceholderText = "Rechercher",
additionalClasses = "btn btn-default" ## <-- add custom class
),
verbatimTextOutput("res_single"),
virtualSelectInput(
inputId = "multiple",
label = "Multiple select:",
choices = setNames(month.abb, month.name),
multiple = TRUE,
additionalClasses = "btn btn-primary" ## <-- add custom class
),
verbatimTextOutput("res_multiple")
)
server <- function(input, output, session) {
output$res_single <- renderPrint(input$single)
output$res_multiple <- renderPrint(input$multiple)
}
if (interactive())
shinyApp(ui, server) |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Is there a way to style the Virtual Select component using Bootstrap to match other shiny components? I couldn't find anything on styling Virtual Select itself, so I'm not very optimistic about that. But maybe somebody else knows how it could be approached?
Beta Was this translation helpful? Give feedback.
All reactions