选择闪亮的输入样式 [英] Selectize Input style in shiny

查看:39
本文介绍了选择闪亮的输入样式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试自定义 shiny 中的选择输入.我所拥有的是:

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

我想要的是更改所选项目的颜色,如下所示:

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

我尝试更改 css ,但是通过添加以下内容,我仅设法更改了该"a"颜色:

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;}

我也想更改"c"和"b"的颜色,但我不知道如何更改.你能帮我吗?

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

我的代码:

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())
    )
)

推荐答案

是否可行(在 fluidPage 之后,在 sidebarLayout 之前)?

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;
     }
  "))
),

这篇关于选择闪亮的输入样式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆