Home > Software design >  Adjust height of FluidRow in R Shiny Dashboard
Adjust height of FluidRow in R Shiny Dashboard

Time:10-03

I have created an RShiny dashboard with three rows:

  • Row 1 = valueboxes and logo
  • Row 2 = 3 plots
  • Row 3 = 2 plots

It looks like this: RShiny dashboard

I used fluidRow() to build them. E.g. code for row 1:

 dashboardBody(
    fluidRow(
     #ROW 1: 
     
     valueBoxOutput("BOX_diaries_sent", width = 4),
     valueBoxOutput("BOX_diaries_complete", width = 4),
     imageOutput("logo_POP") 
     
   ),#End row 1

As you see in the image, the first row is not as heigh as the rows with the plots. I would like to have the grey space removed between row 1 and 2: in other words, place row 1 and 2 up.

Does anyone know how to adjust that?

CodePudding user response:

You can pass css directly into fluidRow like this:

library(shiny)

ui <- fluidPage(
  fluidRow(p("large"), style = "background-color: red;height:250px"),
  fluidRow(p("small"), style = "background-color: blue;height:100px"),
  fluidRow(p("large-again"), style = "background-color: red;height:250px")
)

server <- function(input, output, session) {
  
}

shinyApp(ui, server)

In your case I'd also change height of imageOutput to desired value.

  • Related