Using Shinydashboard Elements in Shiny

Insert shiny dashboard elements into a regular shiny app.

Shinydashboard is built off the Bootstrap Admin LTE theme. It contains some cool elements (value/info boxes) that look pretty snazzy in a shiny dashboard. To use any of these elements (due to the differences in app creation syntax) within your regular shiny app you can’t just load the shinydashboard package.

You’ll just need to grab a couple of CSS files from the shinydashboard package source code.

Navigate to your [R Home]/library/shinydashboard/ and grab:

  • shinydashboard.css
  • AdminLTE/AdminLTE.css

Plug these files into the www/ subdirectory of your shiny app and load them in your ui file using:

library(shinydashboard)

shinyUI(
    fluidPage(
        tags$head(
            includeCSS(file.path('www', path = "AdminLTE.css")),
            includeCSS(file.path('www', path = "shinydashboard.css")
        )
    )
 )

And you can use shiny dashboard elements like normal.

comments powered by Disqus