A bit hacky, but you can use the modal dialog to replicate the landing page.
Basically, use the Shiny native showModal(modalDialog())
command so that the panel showModal(modalDialog())
up over the application. The modal is created in the observeEvent()
server.R
in server.R
, which starts exactly once when the application starts. Custom CSS is included in the ui.R
script, which makes the modal coverage of the entire page. Here is the application:
ui.R
library(shinydashboard) ui <- dashboardPage( dashboardHeader(title = "Basic dashboard"), ## ui.R ## dashboardSidebar( sidebarMenu( menuItem("Dashboard", tabName = "dashboard", icon = icon("dashboard")), menuItem("Widgets", tabName = "widgets", icon = icon("th")) ) ), dashboardBody( tags$head(tags$style(HTML(' .modal.in .modal-dialog{ width:100%; height:100%; margin:0px; } .modal-content{ width:100%; height:100%; } '))), tabItems( # First tab content tabItem(tabName = "dashboard", fluidRow( box(plotOutput("plot1", height = 250)), box( title = "Controls", sliderInput("slider", "Number of observations:", 1, 100, 50) ) ) ), # Second tab content tabItem(tabName = "widgets", h2("Widgets tab content") ) ) ) )
server.R
library(shiny) library(shinydashboard) server <- function(input, output) { set.seed(122) histdata <- rnorm(500) observeEvent(once = TRUE,ignoreNULL = FALSE, ignoreInit = FALSE, eventExpr = histdata, {
A few caveats:
- CSS changes every modal dialog in the application, so you will need to add certain classes to this first modal moment so that all modals are not full-screen.
- It modally technically loads after loading the user interface, so there is a short second when the user can see the application in the background.
I believe that you can fix the latter by looking at the event corresponding to the server loading the application, but, unfortunately, I am not familiar with any such event.