Carlos80
Carlos80

Reputation: 433

Change shinydashboard box width

I'm quiet new to R but am trying to design a UI which has a main box going across the top of the main body with two smaller boxes underneath. At the moment everything I have tried seems to display it in each corner of the main body. Image attahced. The subsection of my code is below:

  dashboardBody(
        fluidRow(
          box(plotlyOutput("Map"))),
        fluidRow(
          box(plotlyOutput("Chart")),
          box(tableOutput("Table")))
        )
      )

I have tried width and height (100%) etc but now joy.

enter image description here

Thanks in advance

Upvotes: 4

Views: 6670

Answers (1)

Pork Chop
Pork Chop

Reputation: 29387

By default box is set to width = 6, so just change that to 12:

box(..., title = NULL, footer = NULL, status = NULL, solidHeader = FALSE, background = NULL, width = 6, height = NULL, collapsible = FALSE, collapsed = FALSE)

library(shiny)
library(plotly)
library(shinydashboard)

ui <- dashboardPage(
  dashboardHeader(),
  dashboardSidebar(),
  dashboardBody(
    fluidRow(
      box(width=12,plotlyOutput("Map"))),
    fluidRow(
      box(plotlyOutput("Chart")),
      box(tableOutput("Table")))
  )
)

server <- function(input, output) { 

}

shinyApp(ui, server)

Upvotes: 5

Related Questions