Hello,
How do I do custom colors for checkboxGroupButtons? When using the code I have below, it seems difficult to tell which ones are selected as they are slightly different shades of blue. I'd prefer to have something along the lines of blue if selected, otherwise gray. Thanks! (Note: I know you can add icons, but I don't want that approach)
library(shiny)
library(shinyWidgets)
ui <- fluidPage(
checkboxGroupButtons(
inputId = "test"
,label = "Testing"
,choices = c("This One", "That One", "Another One")
,selected = c("This One", "That One", "Another One")
,status = "primary"
)
)
server <- function(input, output) {
}
shinyApp(ui = ui, server = server)
Hi @flachboard . Below is one way to achieve the desired outcome using CSS within tags$style()
.
library(shiny)
library(shinyWidgets)
ui <- fluidPage(
tags$style(
HTML(".btn-group > .btn.active {
background-color: blue;
color: white;
}
.btn-mygrey {
background-color: grey;
color: white;
}
")
),
checkboxGroupButtons(
inputId = "test"
,label = "Testing"
,choices = c("This One", "That One", "Another One")
,selected = NA
,status = "mygrey"
)
)
server <- function(input, output) {}
shinyApp(ui = ui, server = server)
1 Like
system
Closed
December 5, 2023, 5:53pm
3
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed. If you have a query related to it or one of the replies, start a new topic and refer back with a link.