如何将 shiny/flexdashboard 的 boxvalues 中的值居中?

How to center values in boxvalues for shiny/flexdashboard?

我的仪表板顶部有这些框值。我想居中对齐标题和值。

为了重现您的示例,我使用了一个 shinydashboard 框架,我将 infobox 放在 column() 中,而 column()fluidRow 中。诀窍是在列中添加 width = 3,align="center"

library(shiny)
library(shinydashboard)

ui <- dashboardPage(
  dashboardHeader(),
  dashboardSidebar(),
  dashboardBody(fluidRow(
    # A static infoBox
   column( infoBox("New Orders", 10 * 2, icon = icon("credit-card")), width = 3,align="center"),

    ),)
)

server <- function(input, output) { }

shinyApp(ui, server)
  • 我的信息框居中

要在 Rmd 文件中呈现它,只需使用这个

---
title: "Untitled"
author: "Daniel"
date: "5/6/2021"
output: html_document
runtime: shiny
---

```{r}
library(shiny)
library(shinydashboard)

ui <- dashboardPage(
  dashboardHeader(),
  dashboardSidebar(),
  dashboardBody(fluidRow(
    # A static infoBox
   column( infoBox("New Orders", 10 * 2, icon =     icon("credit-card")), width = 3,align="center"),

    ),)
)

server <- function(input, output) { }

shinyApp(ui, server)
```

您必须放大闪亮的 Rmarkdown 文件 window 才能获得响应效果。