Learn R Programming

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

shinydashboardPlus

extensions for shinydashboard

Installation

devtools::install_github("DivadNojnarg/shinydashboardPlus")

Motivations

shinydashboardPlus is based on the idea of ygdashboard, the later not compatible with shinydashboard (you cannot use shinydashboard and ygdashboard at the same time). With shinydashboardPlus you can still work with the shinydashboard classic functions and enrich your dashboard with all additional functions of shinydashboardPlus!

Main features

The rightSidebar()

The most interesting feature of this package is the rightSidebar. This concept was not implemented (in R) in ygdashboard (pure HTML), that's why I translated the corresponding HTML code to R. To use it, you will have to replace dashboardPage by dashboardPagePlus and dashboardHeader by dashboardHeaderPlus. Creating this two additional functions let you choose whether you want to use this extra sidebar or not.

The template below will create the most basic shinydashboardPlus page:

library(shiny)
library(shinydashboard)
library(shinydashboardPlus)
shinyApp(
  ui = dashboardPagePlus(
    header = dashboardHeaderPlus(
     enable_rightsidebar = TRUE,
     rightSidebarIcon = "gears"
    ),
    sidebar = dashboardSidebar(),
    body = dashboardBody(),
    rightsidebar = rightSidebar(),
    title = "DashboardPage"
  ),
  server = function(input, output) { }
)

The rightSidebar function takes the following arguments:

  • background: you can display it either in light or dark mode
  • rightSidebarTabList() will create a menu for your tabPanels. Populate it with

rightSidebarTabItem(), with a unique id and icons

  • rightSidebarPanel is the body of your panels. Fill it with rightSidebarTabContent(),

which id should be the same as in the rightSidebarTabItem(). You can include inputs, text or custom HTML elements.

  • in the dashboardHeaderPlus() function, you can customize the sidebar trigger.
rightSidebar(
 background = "dark",
  rightSidebarTabList(
   rightSidebarTabItem(
    id = 1,
    icon = "desktop"
   ),
   rightSidebarTabItem(
    id = 2
   ),
   rightSidebarTabItem(
    id = 3,
    icon = "paint-brush"
   )
  ),
  rigthSidebarPanel(
   rightSidebarTabContent(
    id = 1,
    title = "Tab 1",
    sliderInput(
     "obs", 
     "Number of observations:",
      min = 0, max = 1000, value = 500
     )
   ),
   rightSidebarTabContent(
    id = 2,
    title = "Tab 2",
    textInput("caption", "Caption", "Data Summary")
   ),
   rightSidebarTabContent(
    id = 3,
    title = "Tab 3",
    numericInput("obs", "Observations:", 10, min = 1, max = 100)
   )
  )
)

WARNINGS: there is a limitation of a maximum of 5 rightSidebarTabItem() in the rightSidebarTabList()! This makes sense since above, the rightSidebar would not be easy to use.

Other components

Improved boxes

library(shiny)
library(shinydashboard)

 shinyApp(
   ui = dashboardPagePlus(
     dashboardHeaderPlus(),
     dashboardSidebar(),
     dashboardBody(
      fluidRow(
       boxPlus(
        title = "Closable Box", 
         closable = TRUE, 
         label_status = "danger",
         status = "warning", 
         solidHeader = FALSE, 
         collapsible = TRUE,
         p("Box Content")
       ),
       boxPlus(
        title = "Closable box, with label", 
         closable = TRUE, 
         enable_label = TRUE,
         label_text = 1,
         label_status = "danger",
         status = "warning", 
         solidHeader = FALSE, 
         collapsible = TRUE,
         p("Box Content")
       )
     )
    )
   ),
   server = function(input, output) {}
 )

library(shiny)
 library(shinydashboard)
 shinyApp(
  ui = dashboardPage(
    dashboardHeader(),
    dashboardSidebar(),
    dashboardBody(
     gradientBox(
      title = "My gradient Box",
      icon = "fa fa-th",
      gradientColor = "teal", 
      boxToolSize = "sm", 
      footer = sliderInput(
       "obs", 
       "Number of observations:",
        min = 0, max = 1000, value = 500
       ),
      "This is a gradient box"
      ),
      gradientBox(
      title = "My gradient Box",
      icon = "fa fa-heart",
      gradientColor = "maroon", 
      boxToolSize = "xs", 
      closable = TRUE,
      footer = "The footer goes here. You can include anything",
      "This is a gradient box"
      )
    ),
    title = "Description Blocks"
  ),
  server = function(input, output) { }
 )

 library(shiny)
 library(shinydashboard)
 shinyApp(
  ui = dashboardPage(
    dashboardHeader(),
    dashboardSidebar(),
    dashboardBody(
     widgetUserBox(
      title = "Nadia Carmichael",
      subtitle = "lead Developer",
      type = 2,
      src = "https://adminlte.io/themes/AdminLTE/dist/img/user7-128x128.jpg",
      color = "yellow",
      "Some text here!",
      footer = "The footer here!"
     ),
     widgetUserBox(
      title = "Alexander Pierce",
      subtitle = "Founder & CEO",
      type = NULL,
      src = "https://adminlte.io/themes/AdminLTE/dist/img/user1-128x128.jpg",
      color = "aqua-active",
      closable = TRUE,
      "Some text here!",
      footer = "The footer here!"
     ),
     widgetUserBox(
      title = "Elizabeth Pierce",
      subtitle = "Web Designer",
      type = NULL,
      src = "https://adminlte.io/themes/AdminLTE/dist/img/user3-128x128.jpg",
      background = TRUE,
      backgroundUrl = "https://images.pexels.com/photos/531880/pexels-photo-531880.jpeg?auto=compress&cs=tinysrgb&h=350",
      closable = TRUE,
      "Some text here!",
      footer = "The footer here!"
     )
    ),
    title = "Description Blocks"
  ),
  server = function(input, output) { }
 )

library(shiny)
 library(shinydashboard)
 shinyApp(
  ui = dashboardPage(
    dashboardHeader(),
    dashboardSidebar(),
    dashboardBody(
     socialBox(
      title = "Social Box",
      subtitle = "example-01.05.2018",
      src = "https://adminlte.io/themes/AdminLTE/dist/img/user4-128x128.jpg",
      "Some text here!",
      attachmentBlock(
       src = "http://kiev.carpediem.cd/data/afisha/o/2d/c7/2dc7670333.jpg",
       title = "Test",
       title_url = "http://google.com",
       "This is the content"
      ),
      comments = tagList(
       boxComment(
        src = "https://adminlte.io/themes/AdminLTE/dist/img/user3-128x128.jpg",
        title = "Comment 1",
        date = "01.05.2018",
        "The first comment"
       ),
       boxComment(
        src = "https://adminlte.io/themes/AdminLTE/dist/img/user5-128x128.jpg",
        title = "Comment 2",
        date = "01.05.2018",
        "The second comment"
       )
      ),
      footer = "The footer here!"
     )
    ),
    title = "Description Blocks"
  ),
  server = function(input, output) { }
 )

Boxes components

library(shiny)
 library(shinydashboard)
 shinyApp(
  ui = dashboardPage(
    dashboardHeader(),
    dashboardSidebar(),
    dashboardBody(
     box(
      solidHeader = FALSE,
      title = "Status summary",
      background = NULL,
      width = 4,
      status = "danger",
      footer = fluidRow(
        column(
          width = 6,
          descriptionBlock(
            number = "17%", 
            number_color = "green", 
            number_icon = "fa fa-caret-up",
            header = "$35,210.43", 
            text = "TOTAL REVENUE", 
            right_border = TRUE,
            margin_bottom = FALSE
          )
        ),
        column(
          width = 6,
          descriptionBlock(
            number = "18%", 
            number_color = "red", 
            number_icon = "fa fa-caret-down",
            header = "1200", 
            text = "GOAL COMPLETION", 
            right_border = FALSE,
            margin_bottom = FALSE
          )
        )
      )
     )
    ),
    title = "Description Blocks"
  ),
  server = function(input, output) { }
 )

library(shiny)
 library(shinydashboard)
 shinyApp(
  ui = dashboardPage(
    dashboardHeader(),
    dashboardSidebar(),
    dashboardBody(
     box(title = "Box with right pad",
      status = "warning",
      fluidRow(
        column(width = 6),
        column(
          width = 6,
          boxPad(
            color = "green",
            descriptionBlock(
              header = "8390", 
              text = "VISITS", 
              right_border = FALSE,
              margin_bottom = TRUE
            ),
            descriptionBlock(
              header = "30%", 
              text = "REFERRALS", 
              right_border = FALSE,
              margin_bottom = TRUE
            ),
            descriptionBlock(
              header = "70%", 
              text = "ORGANIC", 
              right_border = FALSE,
              margin_bottom = FALSE
            )
          )
        )
      )
     )
    ),
    title = "Description Blocks"
  ),
  server = function(input, output) { }
 )

and a lot more (see the demo).

Demo

See a demonstration here or run:

shinydashboardPlusGallery()

Aknowldegments

Copy Link

Version

Install

install.packages('shinydashboardPlus')

Monthly Downloads

13,521

Version

0.2

License

GPL-3

Issues

Pull Requests

Stars

Forks

Maintainer

David Granjon

Last Published

August 18th, 2024

Functions in shinydashboardPlus (0.2)

gradientBox

AdminLTE2 gradient box
accordionItem

AdminLTE2 accordion item
rigthSidebarPanel

AdminLTE2 wrapper for tab content
accordion

AdminLTE2 accordion container
rightSidebarTabList

AdminLTE2 right sidebar tab list
socialButton

AdminLTE2 social button
rightSidebarTabContent

AdminLTE2 tab content
starBlock

AdminLTE2 starBlock
loadingState

AdminLTE2 loading state element
shinydashboardPlusGallery

Launch the shinydashboardPlus Gallery
userPostToolItem

AdminLTE2 user post tool item
rightSidebarTabItem

AdminLTE2 right sidebar tab item
socialBox

AdminLTE2 social box
timelineItem

AdminLTE2 timeline item
userPost

AdminLTE2 user post
userPostMedia

AdminLTE2 user post media
timelineItemMedia

AdminLTE2 timeline media item
boxProfile

AdminLTE2 box profile
boxProfileItem

AdminLTE2 box profile item
userPostToolItemList

AdminLTE2 user post tool item container
boxPad

AdminLTE2 vertical block container
boxPlus

Create a box for the main body of a dashboard
dashboardPagePlus

Dashboard Page with a right sidebar
productList

AdminLTE2 product list container
timelineBlock

AdminLTE2 timeline block
dashboardLabel

AdminLTE2 label
notificationItem

Create a notification item to place in a dropdown notification menu
timelineEnd

AdminLTE2 timeline ending point
timelineLabel

AdminLTE2 timeline label
mailForm

AdminLTE2 mail form
appButton

AdminLTE2 special large button
timelineStart

AdminLTE2 timeline starting point
tagAssert

Assert that a tag has specified properties
navPillsItem

AdminLTE2 nav pill item
todoList

AdminLTE2 todo list container
todoListItem

AdminLTE2 todo list item
navPills

AdminLTE2 nav pill container
messageItem

Create a message item to place in a dropdown message menu
attachmentBlock

AdminLTE2 attachment container
taskItem

Create a task item to place in a dropdown task menu
descriptionBlock

AdminLTE2 description block
dropdownMenu

Create a dropdown menu to place in a dashboard header
productListItem

AdminLTE2 product item
userList

AdminLTE2 user list container
validColors

Valid colors
rightSidebar

AdminLTE2 dashboard right sidebar
userListItem

AdminLTE2 user list item
widgetUserBox

AdminLTE2 widget user box
boxComment

AdminLTE2 box comment
blockQuote

AdminLTE2 block quote
dashboardHeaderPlus

Create a header for a dashboard page
boxProfileItemList

AdminLTE2 box profile item container