I have these box values here at the top of my dashboard. I want to center align the title and the value.
in order to reproduce your example, I used a shinydashboard skeleton, I put the infobox
inside a column()
that was inside a fluidRow
. The trick was adding width = 3,align="center"
in the column.
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)
To render this in a Rmd
file just use this
---
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)
```
You have to zoom into the Rmarkdown file shiny window for the responsive effect.