Marta
Marta

Reputation: 3152

Selectize Input style in shiny

I'm trying to customize my selectize input in shiny. What I have is:

enter image description here

And what I would like to have is to change colour of selected items like here:

enter image description here

I've tried to change my css, but I've managed to change only this "a" colour by adding:

.selectize-input.input-active, .selectize-input.input-active:hover, .selectize-control.multi .selectize-input.focus {border-color: #2196f3 !important;}
.selectize-dropdown .active {background: #2196f3 !important;}

I'd like to change also colour of "c" and "b" but I don't know how. Could you help me please?

My code:

server.R:

library("shiny")

shinyServer(function(input, output){})

ui.R:

library("shiny")

shinyUI(fluidPage(
    sidebarLayout(
        sidebarPanel(
            selectizeInput("select", label=NULL,
                           choices=c("a", "b", "c", "d"),
                           multiple=TRUE, options=list(placeholder="Wybierz"))),
        mainPanel())
    )
)

Upvotes: 3

Views: 3566

Answers (1)

Lorenzo Rossi
Lorenzo Rossi

Reputation: 1481

Is this working (just after fluidPage and before sidebarLayout)?

tags$head(
  tags$style(HTML("
     .item {
       background: #2196f3 !important;
       color: white !important;
     }
     .selectize-dropdown-content .active {
       background: #2196f3 !important;
       color: white !important;
     }
  "))
),

Upvotes: 7

Related Questions