Shinydashboard dashboardPage not working in renderUI

I'm trying to build an app that conditionally renders an entire shinydashboard dashboardPage() (after some login criteria is met) but it seems rendering the whole page does not work with renderUI.

Is there any reason the following code would not render the shinydashboard UI?

library(shiny)
library(shinydashboard)

ui <- uiOutput("app")

server <- function(input, output) {
  
  output$app <- renderUI({
    dashboardPage(
      dashboardHeader(),
      dashboardSidebar(),
      dashboardBody()
    )
  })
}

shinyApp(ui, server)
1 Like