Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

R shiny radiogroup Button change color

Tags:

r

shiny

I am using the library shinythemes https://rstudio.github.io/shinythemes/ but I would like to change the color of radiogroup buttons. How can I change the color?

               radioGroupButtons(
                 status = "primary ",
                 inputId = "indicadores_radiogroup",
                 choices = c("Casos" = "Confirmados", "Muertes"= "Muertes"),
                 
               ),

Thanks

like image 649
coding Avatar asked Sep 17 '25 09:09

coding


1 Answers

For your own specific color, you can try the following:

ui = fluidPage(
    radioGroupButtons(
      #status = "primary ",  ##  you can change status value to change to select few colors
      inputId = "indicadores_radiogroup",
      checkIcon = list(yes = icon("check")),
      choiceValues = c("Confirmados", "Muertes"), 
      choiceNames = c("Casos", "Muertes"),
      justified = TRUE, width = "300px"
    ),
    tags$script("$(\"input:radio[name='indicadores_radiogroup'][value='Confirmados']\").parent().css('background-color', '#FF4500');"),
    tags$script("$(\"input:radio[name='indicadores_radiogroup'][value='Muertes']\").parent().css('background-color', '#7EF373');"),

  )
  server = function(...) {}

  shinyApp(ui, server)
like image 181
YBS Avatar answered Sep 20 '25 01:09

YBS



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!