首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >shinywidget dropdownButton CSS标签

shinywidget dropdownButton CSS标签
EN

Stack Overflow用户
提问于 2019-02-28 16:39:24
回答 1查看 678关注 0票数 0

我正在使用dropdownButton小部件,但我正在努力使用css。我已经尝试过了:

代码语言:javascript
运行
复制
dropdownButton(inputId = "MyDropDownB1",
   tags$div(style = "background-color: #393D3F !important;",
        checkboxGroupInput(...)
        ),
        circle = F, status = "info", icon = icon("gear"), width = "300px",
        label="Recruitment"
      )

这会改变面板的颜色,但我仍然有白色边距。

我希望所有的css都在一个特定的.css文件中,而不是在$div标签中。我应该在我的.css文件中使用哪个标记来指向dropdownButton按钮和面板?

EN

回答 1

Stack Overflow用户

发布于 2019-02-28 16:57:43

我使用了来自shinyWidgets的示例代码,因为您还没有共享任何MWE

#dropdown-menu-MyDropDownB1你必须在你的css中的目标。正如您所看到的,这是基于您在dropdownButton中给定的id名称

代码语言:javascript
运行
复制
# NOT RUN {
## Only run examples in interactive R sessions
if (interactive()) {

  library(shiny)
  library(shinyWidgets)

  ui <- fluidPage(
    tags$head(tags$style(HTML("#dropdown-menu-MyDropDownB1 {
                      background-color: #393D3F !important;}
               ")))
    , 

      dropdownButton(inputId = "MyDropDownB1",

                              checkboxGroupInput("icons", "Choose icons:",
                                                 choiceNames =
                                                   list(icon("calendar"), icon("bed"),
                                                        icon("cog"), icon("bug")),
                                                 choiceValues =
                                                   list("calendar", "bed", "cog", "bug")

                     ),
                     circle = F, status = "info", icon = icon("gear"), width = "300px",
                     label="Recruitment"
      ),

    tags$div(style = "height: 140px;"), # spacing
    verbatimTextOutput(outputId = "out"),
    verbatimTextOutput(outputId = "state")
  )

  server <- function(input, output, session) {

    output$out <- renderPrint({
      cat(
        " # n\n", input$n, "\n",
        "# na\n", input$na
      )
    })

    output$state <- renderPrint({
      cat("Open:", input$mydropdown_state)
    })

  }

  shinyApp(ui, server)

}
# }

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/54921470

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档