我使用ShinyWidget中的pickerInput
div(class = "choosechannel",
pickerInput(inputId = "choosechannel", label = "business channel", width = "150px",
choices = c("In-Branch", "Agency", "Affinity", "Corporate", "Credit Life"),
multiple = TRUE, selected = c("In-Branch", "Agency", "Affinity", "Corporate", "Credit Life"),
options = list(height = 10)))
我想更改pickerInput的高度 这是我尝试使用的代码:
tags$style(".choosechannel-button {height: 26.5px; min-height: 26.5px; padding: 0px;}")
tags$head( tags$style( HTML("#choosechannel-button {font-size: 13px; height: 26.5px; min-height: 26.5px;}")))
tags$style(".choosechannel-container {height: 26.5px; min-height: 26.5px; padding: 0px;}")
tags$head( tags$style( HTML("#choosechannel-container {font-size: 13px; height: 26.5px; min-height: 26.5px;}")))
它们都不起作用。有人知道怎么做吗?
编辑:
正如Wilmar van Ommeren在他的回答中所建议的,我已经尝试在$ style标签中使用.choosechannel .btn {height: 26.5px; font-size: 13px;}
。差不多可以了。它下面仍然有空白。
看起来像这样:
答案 0 :(得分:1)
您快到了。您需要在.btn
类中更改.choosechannel
类。您可以使用点(.choosechannel .btn {...}
)指向另一个类继承的类。
library(shiny)
library(shinyWidgets)
ui <- fluidPage(
tags$style(".choosechannel .btn {height: 26.5px; min-height: 26.5px; padding: 0px;}"),
div(class = "choosechannel",
pickerInput(inputId = "choosechannel", label = "business channel", width = "150px",
choices = c("In-Branch", "Agency", "Affinity", "Corporate", "Credit Life"),
multiple = TRUE, selected = c("In-Branch", "Agency", "Affinity", "Corporate", "Credit Life"),
options = list(height = 10)))
)
server <- function(input, output, session) {
}
shinyApp(ui, server)