css - shinywidget dropdownButton CSS 标签
问题描述
我正在使用 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 文件中,而不是在 tag$div 中。我应该在 .css 文件中使用哪个标签来定位 dropdownButton 按钮和面板?
解决方案
我使用了一个示例代码,shinyWidgets
因为您没有共享任何MWE
#dropdown-menu-MyDropDownB1
你必须在你的CSS中定位的那个。如您所见,这是基于id
您在dropdownButton
# 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)
}
# }
推荐阅读
- swift - 在 Swift 中按类型和属性对异构集合进行排序
- perl - Perl:同形异义词攻击。可以比较 ascii / non-ascii 字符串,视觉上相似吗?
- editor - Mac 上的 Vi 编辑器和备忘单
- angular - 使用单页应用程序 (Spa) 预呈现未通过 IIS AspNetCoreModule 返回正确的 URL 路径
- reactjs - react-select isMulti 过滤选项
- java - 我想不出使用 while 循环将 -1 实现为哨兵值。
- javascript - 从 JQuery 返回 3 个随机配置文件的函数?
- python-3.x - TypeError:+ 的不支持的操作数类型:“int”和“list”错误:
- html - 重用带有 ID 的图像滑块
- python - 为什么 statsmodels 的 OLS 中的四次线性回归与 LibreOffice Calc 不匹配?