Make 'Bootstrap 4' dashboards. Use the full power of 'AdminLTE3', a dashboard template built on top of 'Bootstrap 4' < https://github.com/ColorlibHQ/AdminLTE>.
bs4Dash needs the following code to be added in the header in order to work on shinyapps.io:
shiny::tags$head( shiny::tags$script( "// handle shinyapps.io: we need to extract the worker id and // paste it in the url so that the apps works correctly // get the shiny app.io workerId var workerId = $('base').attr('href'); // ensure that this code does not run on shiny server/pro and locally if (typeof workerId != 'undefined') { // get the initial page url var url = window.location.href; // get the name of the first selected tab // replace the url by the url for shinyapp.io window.location.replace(url + workerId); } " ))
This code has to be embeded as follows:
library(shiny)library(bs4Dash) shiny::shinyApp( ui = bs4DashPage( navbar = bs4DashNavbar(), sidebar = bs4DashSidebar(), controlbar = bs4DashControlbar(), footer = bs4DashFooter(), title = "test", body = bs4DashBody( shiny::tags$head( shiny::tags$script( "// handle shinyapps.io: we need to extract the worker id and // paste it in the url so that the apps works correctly // get the shiny app.io workerId var workerId = $('base').attr('href'); // ensure that this code does not run on shiny server/pro and locally if (typeof workerId != 'undefined') { // get the initial page url var url = window.location.href; // get the name of the first selected tab // replace the url by the url for shinyapp.io window.location.replace(url + workerId); } " ) ) ), server = function(input, output) {})
This issue is fixed on the new github version but you need to wait for the next CRAN release (next week) since shinyapps.io uses the latest CRAN version.
See a working example here.
This package is on CRAN:
# from CRANinstall.packages("bs4Dash")# latest devel versiondevtools::install_github("DivadNojnarg/bs4Dash")
See a preview of the package here and here or run
library(bs4Dash)# classic themebs4DashGallery()# old_school themebs4DashGallery(theme = "old_school")
An applied example can be found here (the original dashboard was made by Philippine Rheins from dreamRs).
Issues are listed here.
bs4Card()
bs4ValueBox()
footer is not shown when the external link is NULLbs4ValueBox()
external link opens in a new pagebs4DashPage()
to control the sidebar opening at startbs4DashGallery()
. Add a "theme" argumentionicon()
(implementation of ionicons)bs4DashNavbar()
(#7, thanks @theRcast)