缩小 DT::dataTableOutput 大小

Shrink DT::dataTableOutput Size

我有一个闪亮的界面,我经常使用 DT::dataTableOutputDT::renderDataTable。但是,我想知道是否有办法缩小 datatable 的大小,例如,使字体和 table 变小。我应该怎么做?

假设我有以下代码:

foo <- function(){
  shinyApp(
    ui = fluidPage(
      DT::dataTableOutput("table")
    ),

    server <- function(input, output) {
      x <- data.frame(1:5, 2:6)
      output$table <- DT::renderDataTable(x)
    }
  )
}

我应该添加哪些选项或标签?

div(DT::dataTableOutput("table"), style = "font-size:50%")

对于较小的字体(UI)

尝试将 width: 75% 添加到 divstyle 参数中:

div(DT::dataTableOutput("table"), style = "font-size: 75%; width: 75%")