如何从shinyWidget更改airDatepicker中日历图标的大小?图标、日历、大小、shinyWidget

2023-09-03 14:08:51 作者:笙念

我在仪表板上使用airDatepicker中的shinyWidget

Here

如图所示,我已经成功地更改了输入容器的大小,但没有更改日历图标的容器(shinywidget放置日历图标的框)。 我想要更改的是用黄色包围的框,而不是我用红色边框标记的图标本身。

基于shinydashboard搭建你的仪表板 二

目前我的代码如下所示:

tags$head( tags$style( HTML("
#choosedate {font-size: 13px; height: 25px;}
#datepickers-container > div > nav {font-size: 13px;}
#datepickers-container > div > div.datepicker--content {font-size: 13px;}
#datepickers-container > div > div.datepicker--buttons > span {font-size: 13px;}
#choosedate_button > i {font-size: 13px; max-height: 25px; height: 25px;}
")))
我将所有字体大小设置为13px,包括日历图标的大小。 在第6行,此部分不起作用:max-height: 25px; height: 25px;

我尝试使用该行代码更改日历图标容器的高度,使其与设置为25px的日期选择器输入容器匹配。

我该怎么做?谢谢。

推荐答案

该过程与previous question中的其他div相同:

library(shiny)
library(shinyWidgets)

ui <- fluidPage(
  tags$head(tags$style(HTML('
                            #choosedate {font-size: 75%}
                            #datepickers-container > div > nav {font-size: 75%;}
                            #datepickers-container > div > div.datepicker--content {font-size: 75%;}
                            #datepickers-container > div > div.datepicker--buttons > span {font-size: 75%;}
                            #choosedate_button > i {font-size: 75%;}
                            '))),
  airDatepickerInput(inputId = "choosedate", label = "month range", range = TRUE, placeholder = "choose month range", dateFormat = "M yy", view = "months", minView = "months", clearButton = TRUE,
                     autoClose = TRUE, update_on = "close", inline = FALSE, monthsField = "monthsShort", separator = " - ",
                     width = "161px", value = c("2010-01-01", "2019-12-31"), addon = "right")
)

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

shinyApp(ui, server)