Learn R Programming

⚠️There's a newer version (2.3.4) of this package.Take me there.

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.

Copy Link

Version

Install

install.packages('bs4Dash')

Monthly Downloads

3,440

Version

0.2.0

License

GPL-2

Issues

Pull Requests

Stars

Forks

Maintainer

David Granjon

Last Published

September 20th, 2018

Functions in bs4Dash (0.2.0)

bs4InfoBox

Boostrap 4 info box
bs4DashControlbar

Create a Boostrap 4 dashboard right sidebar
bs4ProgressBar

Create a Bootstrap 4 progress bar
bs4Loading

AdminLTE3 loading state element
bs4DashGallery

Launch the bs4Dash Gallery
bs4TimelineItemMedia

AdminLTE2 timeline media item
bs4ValueBox

Boostrap 4 value box
bs4TimelineLabel

AdminLTE3 timeline label
bs4DashNavbar

Create a Boostrap 4 dashboard navbar
bs4ValueBoxOutput

Create a value box output (client side)
bs4DashFooter

Create a Boostrap 4 dashboard footer
bs4DashPage

Create a Boostrap 4 dashboard page
bs4DashSidebar

Create a Boostrap 4 dashboard main sidebar
bs4AccordionItem

Create a Bootstrap 4 accordion item
bs4ListGroup

BS4 list group for AdminLTE3
bs4Jumbotron

BS4 jumbotron for AdminLTE3
bs4TimelineItem

AdminLTE3 timeline item
bs4SidebarHeader

Create a Boostrap 4 dashboard main sidebar header
bs4ListGroupItem

BS4 list group item for AdminLTE3
bs4TimelineEnd

AdminLTE3 timeline ending point
bs4SidebarMenuItem

Create a Boostrap 4 dashboard main sidebar menu item
bs4DropdownMenu

Create a Boostrap 4 dashboard dropdown menu
bs4DropdownMenuItem

Create a Boostrap 4 dashboard dropdown menu item
bs4TabCard

Create a Boostrap 4 tabCard
bs4TabItem

One tab to put inside a tab items container
bs4Stars

AdminLTE3 stars
bs4TabItems

A container for tab items
bs4SidebarMenu

Create a Boostrap 4 dashboard main sidebar menu
bs4TabPanel

Create a tabPanel
renderbs4ValueBox

Create a value box (server side)
dropdownDivider

Create a box dropdown divider
bs4TabSetPanel

Create a tabSetPanel
bs4TimelineStart

AdminLTE3 timeline starting point
bs4UserCard

AdminLTE3 widget user card
tagAssert

Assert that a tag has specified properties
dropdownItemList

Create a box dropdown item list
ionicon

BS4 ionicons
dropdownItem

Create a box dropdown item
bs4Timeline

AdminLTE3 timeline block
bs4Carousel

Create a Bootstrap 4 carousel
bs4CarouselItem

Create a Bootstrap 4 carousel item
bs4Callout

Create a Bootstrap 4 callout
bs4Alert

Create a Bootstrap 4 alert
bs4Box

AdminLTE3 simple box
bs4Badge

Create a Bootstrap 4 dashboard badge item
bs4Card

Create a Boostrap 4 card
bs4Accordion

Create a Bootstrap 4 accordion
bs4DashBody

Create a Boostrap 4 dashboard body