R 如何减少Shiny中的侧边栏面板文本大小?

R 如何减少Shiny中的侧边栏面板文本大小?,r,shiny,R,Shiny,如何在我的shining应用程序中减小文本大小并选择输入框大小 现在,我有四个selectInput框和相应的标题,它们非常大。我希望包括多达16个,但与一个缩小的大小。我已经包括了ui.R教程中的一个示例。谢谢你的帮助 更新:我用标记$style行更新了以下代码。这使得文本变小了。现在,我不知道如何使selectInput框变小 shinyUI(fluidPage( titlePanel("censusVis"), sidebarLayout( sidebarPanel(

如何在我的
shining
应用程序中减小文本大小并选择输入框大小

现在,我有四个
selectInput
框和相应的标题,它们非常大。我希望包括多达16个,但与一个缩小的大小。我已经包括了
ui.R
教程中的一个示例。谢谢你的帮助

更新:我用
标记$style
行更新了以下代码。这使得文本变小了。现在,我不知道如何使selectInput框变小

shinyUI(fluidPage(
  titlePanel("censusVis"),

  sidebarLayout(
    sidebarPanel(
      helpText("Create demographic maps with 
        information from the 2010 US Census."),
      tags$style(type='text/css', ".selectize-input { font-size: 10px; line-height: 10px;} .selectize-dropdown { font-size: 10px; line-height: 10px; }")
      selectInput("var", 
        label = "Choose a variable to display",
        choices = c("Percent White", "Percent Black",
          "Percent Hispanic", "Percent Asian"),
        selected = "Percent White"),

      sliderInput("range", 
        label = "Range of interest:",
        min = 0, max = 100, value = c(0, 100))
    ),

    mainPanel(
      textOutput("text1")
    )
  )
))

要减小字体大小,只需在文档标题中添加一点CSS,针对类
“selectize input”
“selectize dropdown”
的元素。(它们分别影响选择栏及其下拉菜单中显示的字体大小。)

要减小控件的宽度,可以将其包装在
fluidRow()
中,并将该行包含的12列中的一部分分配给它

这是一个完全可复制的示例,您只需复制并粘贴到R中即可运行:

library(shiny)

shinyApp(
    ui = fluidPage(
        tags$head(tags$style(HTML("
        .selectize-input, .selectize-dropdown {
          font-size: 75%;
        }
        "))),    
        titlePanel("censusVis"),
        sidebarLayout(
            sidebarPanel(
                helpText("Create demographic maps with
        information from the 2010 US Census."),    
                fluidRow(column(6,
                       selectInput("var",
                            label = "Choose a variable to display",
                            choices = c("Percent White", "Percent Black",
                                "Percent Hispanic", "Percent Asian"),
                            selected = "Percent White")
                )),
                sliderInput("range",
                            label = "Range of interest:",
                            min = 0, max = 100, value = c(0, 100))
                ),
            mainPanel(textOutput("text1"))
        )
    ),
    server = function(input, output) {}
)