是否有办法在闪亮的应用程序中以可反应的方式垂直对齐(中间)单元格中的文本?
下面的最小示例。我尝试了一些CSS选项,但到目前为止还没有运气。
library(shiny)
library(reactable)
ui <- fluidPage(
titlePanel("reactable example"),
reactableOutput("table")
)
server <- function(input, output, session) {
output$table <- renderReactable({
reactable(iris)
})
}
shinyApp(ui, server)
谢谢
您可以使用defaultColDef设置默认属性。下面的代码段应使文本垂直居中对齐:
library(shiny)
library(reactable)
ui <- fluidPage(
titlePanel("reactable example"),
reactableOutput("table")
)
server <- function(input, output, session) {
output$table <- renderReactable({
reactable(iris,
defaultColDef = colDef(
align = "center")
)
})
}
shinyApp(ui, server)
下面是运行代码后的输出。输出在中心和水平都对齐