Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Selectize Input style in shiny

Tags:

html

css

r

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())
    )
)
like image 847
Marta Avatar asked Nov 23 '25 10:11

Marta


1 Answers

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;
     }
  "))
),
like image 196
Lorenzo Rossi Avatar answered Nov 26 '25 03:11

Lorenzo Rossi



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!