How can I place a box()
exactly in the middle of shinydashboard body height and stuck to the most left side of the body next to the sidebar?
library(shiny)
library(shinydashboard)
ui <- dashboardPage(
dashboardHeader(title = "Connected Boxes"),
dashboardSidebar(),
dashboardBody(
fluidRow(
# Empty column to offset box to the center
column(1, offset = 0),
box(
title = "Middle Box",
width = 1,
height = 200,
style = "background-color: #f9f9f9; border-color: #dddddd;"
)
)
)
)
server <- function(input, output) {}
shinyApp(ui, server)
A solution is to adjust the column size from 1 to 6 as demonstrated in the following code:
column(6,offset = 0)
Take note that the combined sizes of the columns in fluidRow()
cannot exceed 12. This means that if you want to include 3 columns in your dashboard body, they can only be as follow:
fluidRow(
column(4,. . .)
column(4,. . .)
column(4,. . .)
)
I hope this is what you are looking for!