mercredi 11 janvier 2023

Color group buttons in Shiny when clicked

I'm having trouble changing the color of checkboxGroupButton when clicked. There doesn't seem to be any way to do a checkboxGroup in shiny where you can specify the color of the button pre and post click.

The code below will make the boxes change colors but only between white and grey. I want to customize the color it is by default and also when clicked.

              checkboxGroupButtons(
                inputId = "checkboxInput", label = "", 
                choices = c("A", "B", "C", "D"), 
                justified = FALSE, 
                status = "default",
                individual = TRUE,
                direction = "vertical",
                selected = "A",
                checkIcon = list(
                  yes = icon("circle-check", class = "fa-regular"),
                  no = icon("circle", class = "fa-regular")
                )
              )

I included this tag and can get it to change to color orange but I can't get it to change to another color when clicked.

  tags$style(
    HTML(
      "
      .btn.checkbtn {
        font-size: 15px;
        line-height: 1px;
        border-color: #0C3261;
        border-width: 2px;
        background-color: orange;
        margin-bottom: 1px; /*set the margin, so boxes don't overlap*/
      }
      "
    )
  ),




Aucun commentaire:

Enregistrer un commentaire