Search code examples
rshinyoffset

How to vertically offset a wellPanel from the very top?


I have a layout with just one row and one column in a wellPanel. My goal is to offset this panel vertically. At the moment it is "glued" to the very top, but should move down by some centimeters.

library(shiny)

ui <- fluidPage(
  wellPanel(fluidRow(column(width = 11, align = "center", h3("I need to move south!")))))

server <- function(input, output) {}

shinyApp(ui = ui, server = server)

Solution

  • You can wrap a wellPanel() in an absolutePanel()

    library(shiny)
    ui <- fluidPage(
       absolutePanel(top = "50%", left = 20, width = "97.5%", 
                wellPanel(
                  fluidRow(
                    column(
                      width = 12,
                      align = "center", h3("I am at the centre!")
                    )
                  )
                )
     )
    )
    
    server <- function(input, output){}
    shinyApp(ui, server)