MissMonicaE
MissMonicaE

Reputation: 727

shinydashboard: my boxes don't want to take up the whole column

I'm building an app with a lot of boxes using shinydashboard. Ideally I'd like to have three boxes in one fluidRow. If I just plop them in, they widen so much that the third gets bumped down, but if I put them each in their own column(width = 4, ...), then each of them only takes up about half its column, leaving unsightly gaps between them.

Is there a way to force a box to take up its whole column?

Upvotes: 1

Views: 1689

Answers (1)

Geovany
Geovany

Reputation: 5687

By default, the box function has a width = 6, you can change it to 12 to cover all the column. However, according to the shinydashboard documentation, you should set width = NULL for column-based layouts. See the example below.

library(shiny)
library(shinydashboard)

ui <- dashboardPage(
        dashboardHeader(),
        dashboardSidebar(),
        dashboardBody(
          fluidRow( 
            column(4, box(title = "box1", width = NULL)),
            column(4, box(title = "box2", width = NULL)),
            column(4, box(title = "box3", width = NULL))
          )
        )
      )

server <- function(input, output) {
}

shinyApp(ui, server) 

Upvotes: 3

Related Questions