0

I'd like to style particular radio buttons while using bslib themes, but they are unaffected by my rules. Why is this?

For example,

library(shiny)
library(bslib)
library(shinyWidgets)

theme = bs_theme(version = 5, bootswatch = "minty")

ui = page_fluid(theme = theme,
                tags$head(
                  tags$style(".btn-default background-color: #7a6bd1;"),
                  tags$style(".btn-default.active background-color: #eb4034;")
                ),
                radioGroupButtons("radio",
                                  label = NULL,
                                  choices = c("Left", "Right"),
                                  selected = "Left")
)

server = function(input, output)
{
}

shinyApp(ui, server)

Targeting buttons based on specific divs would be best, something like,

tags$style("#radio .btn background-color: #eb4034")

but this doesn't work either.

matt
  • 318
  • 3
  • 11

1 Answers1

0

Not sure about the exact look you want to have, but perhaps something along the lines of this may bring you closer to what you're look for or at least give some hints?

tags$style("#radio .btn.radiobtn.btn-outline-primary {background: #eb4034;}")

It may be also worth highlighting that shinyWidgets and bslib don't always play nice together in terms of css, there's some bugs reported. It's not your issue, really, but still something to keep in mind if things don't behave as expected.

giocomai
  • 3,043
  • 21
  • 24