bs4Dash
Bootstrap 4 shinydashboard using AdminLTE3
Important note
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.
Installation
This package is on CRAN:
# from CRAN
install.packages("bs4Dash")
# latest devel version
devtools::install_github("DivadNojnarg/bs4Dash")
Demo
See a preview of the package here and here or run
library(bs4Dash)
# classic theme
bs4DashGallery()
# old_school theme
bs4DashGallery(theme = "old_school")
An applied example can be found here (the original dashboard was made by Philippine Rheins from dreamRs).
Issues
Issues are listed here.