shiny app gives diff output in reprex than otherwise

30 Views Asked by At

This is baffling me for last couple of hours. In the below reprex the output turns out perfectly as expected if it is run using reprex() but gives unexpected UI output (wellPanel does not render outside valueboxes) if we run the same in two different machines and in a fresh R session as well !

I would really appreciate if some of you just ran the below code and see what output you get.

library(shiny)
library(shinydashboard)
#> 
#> Attaching package: 'shinydashboard'
#> The following object is masked from 'package:graphics':
#> 
#>     box

ui <- dashboardPage(
  dashboardHeader(),
  dashboardSidebar(),
  dashboardBody(
    fluidRow(
      column(
        width = 6,
        wellPanel(
          valueBoxOutput("vb1")
        )
      ),
      column(
        width = 6,
        wellPanel(
          valueBoxOutput("vb2")
        )
      )
    )
  )
)

server <- function(input, output) {
  output$vb1 <- renderValueBox({
    valueBox(42, "Value Box 1")
  })
  output$vb2 <- renderValueBox({
    valueBox(69, "Value Box 2")
  })
}

shinyApp(ui, server)
#> 
#> Listening on http://127.0.0.1:7101

Created on 2023-03-19 with reprex v2.0.2

Above is using reprex and gives the correct output.

But on running the same file in my ubuntu server as well as local macbook pro both give the following defective UI: enter image description here

I am starting a fresh R session and still the same output. The code when copied outside the original machine (ubuntu server) into a local machine in a fresh session also gives the same problem that wellPanels are not formed.

What's going on here?

1

There are 1 best solutions below

1
Julian_Hn On

The issue here is to do with the aspect ratio. If you take you browser window and make it less wide, the panels will rescale to the same view as the reprex example (tested on FF on Linux Mint)

Narrow Window:

Narrow Window

Wide Window:

Wide Window