我正在使用dropdownButton小部件,但我正在努力使用css。我已经尝试过了:
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按钮和面板?
发布于 2019-02-28 16:57:43
我使用了来自shinyWidgets
的示例代码,因为您还没有共享任何MWE
#dropdown-menu-MyDropDownB1
你必须在你的css中的目标。正如您所看到的,这是基于您在dropdownButton
中给定的id
名称
# 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)
}
# }
https://stackoverflow.com/questions/54921470
复制相似问题