Title: | Add More 'AdminLTE2' Components to 'shinydashboard' |
---|---|
Description: | Extend 'shinydashboard' with 'AdminLTE2' components. 'AdminLTE2' is a free 'Bootstrap 3' dashboard template available at <https://adminlte.io>. Customize boxes, add timelines and a lot more. |
Authors: | David Granjon [aut, cre], RinteRface [cph], Almasaeed Studio [ctb, cph] (AdminLTE2 theme for Bootstrap 3), Guang Yang [ctb, cph] (ygdashboard original template), Winston Chang [ctb, cph] (Functions from shinydashboard), Victor Perrier [ctb] (improved the shinydashboardPlusGallery) |
Maintainer: | David Granjon <[email protected]> |
License: | GPL (>= 2) | file LICENSE |
Version: | 2.0.5 |
Built: | 2024-10-30 05:16:18 UTC |
Source: | https://github.com/rinterface/shinydashboardplus |
Create an accordion container. Accordions are part of collapsible elements.
accordionItem creates an accordion item to put inside an accordion container.
updateAccordion toggles an accordion on the client.
accordion(..., id = NULL, width = 12) accordionItem(..., title, status = NULL, collapsed = TRUE, solidHeader = TRUE) updateAccordion(id, selected, session = shiny::getDefaultReactiveDomain())
accordion(..., id = NULL, width = 12) accordionItem(..., title, status = NULL, collapsed = TRUE, solidHeader = TRUE) updateAccordion(id, selected, session = shiny::getDefaultReactiveDomain())
... |
slot for accordionItem. |
id |
Accordion to target. |
width |
The width of the accordion. |
title |
Optional title. |
status |
The status of the item This determines the item's background color. Valid statuses are defined as follows:
Only primary, success, info, warning and danger are compatible with solidHeader! |
collapsed |
If TRUE, start collapsed. This must be used with
|
solidHeader |
Should the header be shown with a solid color background? |
selected |
Index of the newly selected accordionItem. |
session |
Shiny session object. |
David Granjon, [email protected]
if (interactive()) { library(shiny) library(shinydashboard) library(shinydashboardPlus) shinyApp( ui = dashboardPage( dashboardHeader(), dashboardSidebar(), dashboardBody( accordion( id = "accordion1", accordionItem( title = "Accordion 1 Item 1", status = "danger", collapsed = TRUE, "This is some text!" ), accordionItem( title = "Accordion 1 Item 2", status = "warning", collapsed = FALSE, "This is some text!" ) ), accordion( id = "accordion2", accordionItem( title = "Accordion 2 Item 1", status = "info", collapsed = TRUE, "This is some text!" ), accordionItem( title = "Accordion 2 Item 2", status = "success", collapsed = FALSE, "This is some text!" ) ) ), title = "Accordion" ), server = function(input, output) { } ) } # Update accordion if (interactive()) { library(shiny) library(shinydashboard) library(shinydashboardPlus) shinyApp( ui = dashboardPage( dashboardHeader(), dashboardSidebar(), dashboardBody( radioButtons("controller", "Controller", choices = c(1, 2)), br(), accordion( id = "accordion1", accordionItem( title = "Accordion 1 Item 1", status = "danger", collapsed = TRUE, "This is some text!" ), accordionItem( title = "Accordion 1 Item 2", status = "warning", collapsed = TRUE, "This is some text!" ) ) ), title = "Update Accordion" ), server = function(input, output, session) { observeEvent(input$controller, { updateAccordion(id = "accordion1", selected = input$controller) }) observe(print(input$accordion1)) observeEvent(input$accordion1, { showNotification( sprintf("You selected accordion N° %s", input$accordion1), type = "message" ) }) } ) }
if (interactive()) { library(shiny) library(shinydashboard) library(shinydashboardPlus) shinyApp( ui = dashboardPage( dashboardHeader(), dashboardSidebar(), dashboardBody( accordion( id = "accordion1", accordionItem( title = "Accordion 1 Item 1", status = "danger", collapsed = TRUE, "This is some text!" ), accordionItem( title = "Accordion 1 Item 2", status = "warning", collapsed = FALSE, "This is some text!" ) ), accordion( id = "accordion2", accordionItem( title = "Accordion 2 Item 1", status = "info", collapsed = TRUE, "This is some text!" ), accordionItem( title = "Accordion 2 Item 2", status = "success", collapsed = FALSE, "This is some text!" ) ) ), title = "Accordion" ), server = function(input, output) { } ) } # Update accordion if (interactive()) { library(shiny) library(shinydashboard) library(shinydashboardPlus) shinyApp( ui = dashboardPage( dashboardHeader(), dashboardSidebar(), dashboardBody( radioButtons("controller", "Controller", choices = c(1, 2)), br(), accordion( id = "accordion1", accordionItem( title = "Accordion 1 Item 1", status = "danger", collapsed = TRUE, "This is some text!" ), accordionItem( title = "Accordion 1 Item 2", status = "warning", collapsed = TRUE, "This is some text!" ) ) ), title = "Update Accordion" ), server = function(input, output, session) { observeEvent(input$controller, { updateAccordion(id = "accordion1", selected = input$controller) }) observe(print(input$accordion1)) observeEvent(input$accordion1, { showNotification( sprintf("You selected accordion N° %s", input$accordion1), type = "message" ) }) } ) }
Create a large button ideal for web applications but identical to the classic Shiny action button.
appButton(..., inputId, label, icon = NULL, width = NULL)
appButton(..., inputId, label, icon = NULL, width = NULL)
... |
Named attributes to be applied to the button or link. |
inputId |
The |
label |
The contents of the button or link–usually a text label, but you could also use any other HTML, like an image. |
icon |
An optional |
width |
The width of the input, e.g. |
David Granjon, [email protected]
if (interactive()) { library(shiny) library(shinydashboard) library(shinydashboardPlus) shinyApp( ui = dashboardPage( dashboardHeader(), dashboardSidebar(), dashboardBody( box( title = "App Buttons", status = NULL, appButton( inputId = "myAppButton", label = "Users", icon = icon("users"), dashboardBadge(textOutput("btnVal"), color = "blue") ) ) ), title = "App buttons" ), server = function(input, output) { output$btnVal <- renderText(input$myAppButton) } ) }
if (interactive()) { library(shiny) library(shinydashboard) library(shinydashboardPlus) shinyApp( ui = dashboardPage( dashboardHeader(), dashboardSidebar(), dashboardBody( box( title = "App Buttons", status = NULL, appButton( inputId = "myAppButton", label = "Users", icon = icon("users"), dashboardBadge(textOutput("btnVal"), color = "blue") ) ) ), title = "App buttons" ), server = function(input, output) { output$btnVal <- renderText(input$myAppButton) } ) }
attachmentBlock create an attachment container, nice to wrap articles... and insert in a box.
attachmentBlock(..., image, title = NULL, href = NULL)
attachmentBlock(..., image, title = NULL, href = NULL)
... |
any element. |
image |
url or path to the image. |
title |
attachment title. |
href |
external link. |
David Granjon, [email protected]
# Box with attachmentBlock if (interactive()) { library(shiny) library(shinydashboard) library(shinydashboardPlus) shinyApp( ui = dashboardPage( dashboardHeader(), dashboardSidebar(), dashboardBody( box( title = "Attachment example", attachmentBlock( image = "https://adminlte.io/themes/AdminLTE/dist/img/photo1.png", title = "Test", href = "https://google.com", "This is the content" ) ) ), title = "AttachmentBlock" ), server = function(input, output) { } ) }
# Box with attachmentBlock if (interactive()) { library(shiny) library(shinydashboard) library(shinydashboardPlus) shinyApp( ui = dashboardPage( dashboardHeader(), dashboardSidebar(), dashboardBody( box( title = "Attachment example", attachmentBlock( image = "https://adminlte.io/themes/AdminLTE/dist/img/photo1.png", title = "Test", href = "https://google.com", "This is the content" ) ) ), title = "AttachmentBlock" ), server = function(input, output) { } ) }
If you want to quote text
blockQuote(..., side = "left")
blockQuote(..., side = "left")
... |
any element. |
side |
blockquote orientation. "left" by default, can be set to "right". |
David Granjon, [email protected]
if (interactive()) { library(shiny) library(shinydashboard) library(shinydashboardPlus) shinyApp( ui = dashboardPage( dashboardHeader(), dashboardSidebar(), dashboardBody( box( title = "BlockQuote example", blockQuote("I quote some text here!"), blockQuote("I quote some text here!", side = "right") ) ), title = "blockQuote" ), server = function(input, output) { } ) }
if (interactive()) { library(shiny) library(shinydashboard) library(shinydashboardPlus) shinyApp( ui = dashboardPage( dashboardHeader(), dashboardSidebar(), dashboardBody( box( title = "BlockQuote example", blockQuote("I quote some text here!"), blockQuote("I quote some text here!", side = "right") ) ), title = "blockQuote" ), server = function(input, output) { } ) }
box can be used to hold content in the main body of a dashboard.
updateBox is used to toggle, close or restore a box on the client.
boxDropdown is used in the dropdown parameter of box.
boxDropdownItem goes in boxDropdown.
dropdownDivider goes in boxDropdown but also in any dropdown menu container.
boxPad creates a vertical container for descriptionBlock. It has to be included in a box.
descriptionBlock creates a description block, perfect for writing statistics to insert in a box
box( ..., title = NULL, footer = NULL, status = NULL, solidHeader = FALSE, background = NULL, width = 6, height = NULL, collapsible = FALSE, collapsed = FALSE, closable = FALSE, icon = NULL, gradient = FALSE, boxToolSize = "sm", headerBorder = TRUE, label = NULL, dropdownMenu = NULL, sidebar = NULL, id = NULL ) updateBox( id, action = c("remove", "toggle", "restore", "update"), options = NULL, session = shiny::getDefaultReactiveDomain() ) boxDropdown(..., icon = shiny::icon("wrench")) boxDropdownItem(..., id = NULL, href = NULL, icon = NULL) dropdownDivider() boxPad(..., color = NULL, style = NULL) descriptionBlock( number = NULL, numberColor = NULL, numberIcon = NULL, header = NULL, text = NULL, rightBorder = TRUE, marginBottom = FALSE )
box( ..., title = NULL, footer = NULL, status = NULL, solidHeader = FALSE, background = NULL, width = 6, height = NULL, collapsible = FALSE, collapsed = FALSE, closable = FALSE, icon = NULL, gradient = FALSE, boxToolSize = "sm", headerBorder = TRUE, label = NULL, dropdownMenu = NULL, sidebar = NULL, id = NULL ) updateBox( id, action = c("remove", "toggle", "restore", "update"), options = NULL, session = shiny::getDefaultReactiveDomain() ) boxDropdown(..., icon = shiny::icon("wrench")) boxDropdownItem(..., id = NULL, href = NULL, icon = NULL) dropdownDivider() boxPad(..., color = NULL, style = NULL) descriptionBlock( number = NULL, numberColor = NULL, numberIcon = NULL, header = NULL, text = NULL, rightBorder = TRUE, marginBottom = FALSE )
... |
any element such as descriptionBlock. |
title |
Optional title. |
footer |
Optional footer text. |
status |
The status of the item This determines the item's background color. Valid statuses are defined as follows:
Only primary, success, info, warning and danger are compatible with solidHeader! |
solidHeader |
Should the header be shown with a solid color background? |
background |
If NULL (the default), the background of the box will be white. Otherwise, a color string. Valid colors are listed in validColors. See below:
|
width |
The width of the box, using the Bootstrap grid system. This is
used for row-based layouts. The overall width of a region is 12, so the
default valueBox width of 4 occupies 1/3 of that width. For column-based
layouts, use |
height |
The height of a box, in pixels or other CSS unit. By default the height scales automatically with the content. |
collapsible |
If TRUE, display a button in the upper right that allows the user to collapse the box. |
collapsed |
If TRUE, start collapsed. This must be used with
|
closable |
If TRUE, display a button in the upper right that allows the user to close the box. |
icon |
Optional icon. Expect icon. |
gradient |
Whether to allow gradient effect for the background color. Default to FALSE. |
boxToolSize |
Size of the toolbox: choose among "xs", "sm", "md", "lg". |
headerBorder |
Whether to display a border between the header and body. TRUE by default. |
label |
Slot for boxLabel. |
dropdownMenu |
List of items in the boxtool dropdown menu. Use boxDropdown. |
sidebar |
Slot for boxSidebar. |
id |
If passed, the item will behave like an action button. |
action |
Action to trigger: either collapse, remove, restore or update. |
options |
If action is update, a list of new options to configure the box, such as
|
session |
Shiny session object. |
href |
Target url or page. |
color |
background color: see here for a list of valid colors https://adminlte.io/themes/AdminLTE/pages/UI/general.html. See below:
|
style |
custom CSS, if any. |
number |
any number. |
numberColor |
number color: see here for a list of valid colors https://adminlte.io/themes/AdminLTE/pages/UI/general.html. See below:
|
numberIcon |
number icon, if any. Expect |
header |
bold text. |
text |
additional text. |
rightBorder |
TRUE by default. Whether to display a right border to separate two blocks. The last block on the right should not have a right border. |
marginBottom |
FALSE by default. Set it to TRUE when the descriptionBlock is used in a boxPad context. |
# A box with label, sidebar, dropdown menu if (interactive()) { library(shiny) library(shinydashboard) library(shinydashboardPlus) shinyApp( ui = dashboardPage( dashboardHeader(), dashboardSidebar(), dashboardBody( box( title = "Closable Box with dropdown", closable = TRUE, width = 12, status = "warning", solidHeader = FALSE, collapsible = TRUE, label = boxLabel( text = 1, status = "danger", style = "circle" ), dropdownMenu = boxDropdown( boxDropdownItem("Link to google", href = "https://www.google.com"), boxDropdownItem("item 2", href = "#"), dropdownDivider(), boxDropdownItem("item 3", href = "#", icon = icon("table-cells")) ), sidebar = boxSidebar( startOpen = TRUE, id = "mycardsidebar", sliderInput( "obs", "Number of observations:", min = 0, max = 1000, value = 500 ) ), plotOutput("distPlot") ) ) ), server = function(input, output) { output$distPlot <- renderPlot({ hist(rnorm(input$obs)) }) } ) } # Toggle a box on the client if (interactive()) { library(shiny) library(shinydashboard) library(shinydashboardPlus) ui <- dashboardPage( dashboardHeader(), dashboardSidebar(), dashboardBody( tags$style("body { background-color: ghostwhite}"), fluidRow( actionButton("toggle_box", "Toggle Box"), actionButton("remove_box", "Remove Box", class = "bg-danger"), actionButton("restore_box", "Restore Box", class = "bg-success") ), actionButton("update_box", "Update Box", class = "bg-info"), actionButton("update_box2", "Update Box 2", class = "bg-info"), br(), br(), box( title = textOutput("box_state"), id = "mybox", status = "danger", background = "maroon", gradient = TRUE, collapsible = TRUE, closable = TRUE, plotOutput("plot") ) ) ) server <- function(input, output, session) { output$plot <- renderPlot({ req(!input$mybox$collapsed) plot(rnorm(200)) }) output$box_state <- renderText({ state <- if (input$mybox$collapsed) "collapsed" else "uncollapsed" paste("My box is", state) }) observeEvent(input$toggle_box, { updateBox("mybox", action = "toggle") }) observeEvent(input$remove_box, { updateBox("mybox", action = "remove") }) observeEvent(input$restore_box, { updateBox("mybox", action = "restore") }) observeEvent(input$mybox$visible, { collapsed <- if (input$mybox$collapsed) "collapsed" else "uncollapsed" visible <- if (input$mybox$visible) "visible" else "hidden" message <- paste("My box is", collapsed, "and", visible) showNotification(message, type = "warning", duration = 1) }) observeEvent(input$update_box, { updateBox( "mybox", action = "update", options = list( title = h2("hello", dashboardLabel(1, status = "primary")), status = "warning", solidHeader = TRUE, width = 12, background = NULL, height = "900px", closable = FALSE ) ) }) observeEvent(input$update_box2, { updateBox( "mybox", action = "update", options = list( status = NULL, solidHeader = FALSE, width = 4, background = "green", height = "500px", closable = TRUE ) ) }) } shinyApp(ui, server) } # Box with dropdown items and input if (interactive()) { library(shiny) library(shinydashboard) library(shinydashboardPlus) shinyApp( ui = dashboardPage( dashboardHeader(), dashboardSidebar(), dashboardBody( box( title = "Closable Box with dropdown", closable = TRUE, width = 12, status = "warning", solidHeader = FALSE, collapsible = TRUE, dropdownMenu = boxDropdown( boxDropdownItem("Click me", id = "dropdownItem", icon = icon("heart")), boxDropdownItem("item 2", href = "https://www.google.com/"), dropdownDivider(), boxDropdownItem("item 3", icon = icon("table-cells")) ), "My box" ) ) ), server = function(input, output) { observeEvent(input$dropdownItem, { showNotification("Hello", duration = 1, type = "message") }) } ) } # Box with boxPad container + descriptionBlock if (interactive()) { library(shiny) library(shinydashboard) library(shinydashboardPlus) 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", rightBorder = FALSE, marginBottom = TRUE ), descriptionBlock( header = "30%", text = "REFERRALS", rightBorder = FALSE, marginBottom = TRUE ), descriptionBlock( header = "70%", text = "ORGANIC", rightBorder = FALSE, marginBottom = FALSE ) ) ) ) ) ), title = "boxPad" ), server = function(input, output) { } ) } # Box with descriptionBlock if (interactive()) { library(shiny) library(shinydashboard) library(shinydashboardPlus) 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%", numberColor = "green", numberIcon = icon("caret-up"), header = "$35,210.43", text = "TOTAL REVENUE", rightBorder = TRUE, marginBottom = FALSE ) ), column( width = 6, descriptionBlock( number = "18%", numberColor = "red", numberIcon = icon("caret-down"), header = "1200", text = "GOAL COMPLETION", rightBorder = FALSE, marginBottom = FALSE ) ) ) ) ), title = "Description Blocks" ), server = function(input, output) { } ) }
# A box with label, sidebar, dropdown menu if (interactive()) { library(shiny) library(shinydashboard) library(shinydashboardPlus) shinyApp( ui = dashboardPage( dashboardHeader(), dashboardSidebar(), dashboardBody( box( title = "Closable Box with dropdown", closable = TRUE, width = 12, status = "warning", solidHeader = FALSE, collapsible = TRUE, label = boxLabel( text = 1, status = "danger", style = "circle" ), dropdownMenu = boxDropdown( boxDropdownItem("Link to google", href = "https://www.google.com"), boxDropdownItem("item 2", href = "#"), dropdownDivider(), boxDropdownItem("item 3", href = "#", icon = icon("table-cells")) ), sidebar = boxSidebar( startOpen = TRUE, id = "mycardsidebar", sliderInput( "obs", "Number of observations:", min = 0, max = 1000, value = 500 ) ), plotOutput("distPlot") ) ) ), server = function(input, output) { output$distPlot <- renderPlot({ hist(rnorm(input$obs)) }) } ) } # Toggle a box on the client if (interactive()) { library(shiny) library(shinydashboard) library(shinydashboardPlus) ui <- dashboardPage( dashboardHeader(), dashboardSidebar(), dashboardBody( tags$style("body { background-color: ghostwhite}"), fluidRow( actionButton("toggle_box", "Toggle Box"), actionButton("remove_box", "Remove Box", class = "bg-danger"), actionButton("restore_box", "Restore Box", class = "bg-success") ), actionButton("update_box", "Update Box", class = "bg-info"), actionButton("update_box2", "Update Box 2", class = "bg-info"), br(), br(), box( title = textOutput("box_state"), id = "mybox", status = "danger", background = "maroon", gradient = TRUE, collapsible = TRUE, closable = TRUE, plotOutput("plot") ) ) ) server <- function(input, output, session) { output$plot <- renderPlot({ req(!input$mybox$collapsed) plot(rnorm(200)) }) output$box_state <- renderText({ state <- if (input$mybox$collapsed) "collapsed" else "uncollapsed" paste("My box is", state) }) observeEvent(input$toggle_box, { updateBox("mybox", action = "toggle") }) observeEvent(input$remove_box, { updateBox("mybox", action = "remove") }) observeEvent(input$restore_box, { updateBox("mybox", action = "restore") }) observeEvent(input$mybox$visible, { collapsed <- if (input$mybox$collapsed) "collapsed" else "uncollapsed" visible <- if (input$mybox$visible) "visible" else "hidden" message <- paste("My box is", collapsed, "and", visible) showNotification(message, type = "warning", duration = 1) }) observeEvent(input$update_box, { updateBox( "mybox", action = "update", options = list( title = h2("hello", dashboardLabel(1, status = "primary")), status = "warning", solidHeader = TRUE, width = 12, background = NULL, height = "900px", closable = FALSE ) ) }) observeEvent(input$update_box2, { updateBox( "mybox", action = "update", options = list( status = NULL, solidHeader = FALSE, width = 4, background = "green", height = "500px", closable = TRUE ) ) }) } shinyApp(ui, server) } # Box with dropdown items and input if (interactive()) { library(shiny) library(shinydashboard) library(shinydashboardPlus) shinyApp( ui = dashboardPage( dashboardHeader(), dashboardSidebar(), dashboardBody( box( title = "Closable Box with dropdown", closable = TRUE, width = 12, status = "warning", solidHeader = FALSE, collapsible = TRUE, dropdownMenu = boxDropdown( boxDropdownItem("Click me", id = "dropdownItem", icon = icon("heart")), boxDropdownItem("item 2", href = "https://www.google.com/"), dropdownDivider(), boxDropdownItem("item 3", icon = icon("table-cells")) ), "My box" ) ) ), server = function(input, output) { observeEvent(input$dropdownItem, { showNotification("Hello", duration = 1, type = "message") }) } ) } # Box with boxPad container + descriptionBlock if (interactive()) { library(shiny) library(shinydashboard) library(shinydashboardPlus) 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", rightBorder = FALSE, marginBottom = TRUE ), descriptionBlock( header = "30%", text = "REFERRALS", rightBorder = FALSE, marginBottom = TRUE ), descriptionBlock( header = "70%", text = "ORGANIC", rightBorder = FALSE, marginBottom = FALSE ) ) ) ) ) ), title = "boxPad" ), server = function(input, output) { } ) } # Box with descriptionBlock if (interactive()) { library(shiny) library(shinydashboard) library(shinydashboardPlus) 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%", numberColor = "green", numberIcon = icon("caret-up"), header = "$35,210.43", text = "TOTAL REVENUE", rightBorder = TRUE, marginBottom = FALSE ) ), column( width = 6, descriptionBlock( number = "18%", numberColor = "red", numberIcon = icon("caret-down"), header = "1200", text = "GOAL COMPLETION", rightBorder = FALSE, marginBottom = FALSE ) ) ) ) ), title = "Description Blocks" ), server = function(input, output) { } ) }
boxLabel is inserted in the label slot of box.
boxLabel(text, status, style = "default")
boxLabel(text, status, style = "default")
text |
Label text. In practice only few letters or a number. |
status |
label color status. See https://adminlte.io/themes/AdminLTE/pages/UI/general.html. Valid statuses are defined as follows:
|
style |
label border style: "default" (rounded angles), "circle" or "square". |
boxProfile goes inside a box. Displays user information in an elegant container.
boxProfileItem is an sub-element of a boxProfile.
boxProfile(..., image = NULL, title, subtitle = NULL, bordered = FALSE) boxProfileItem(title, description)
boxProfile(..., image = NULL, title, subtitle = NULL, bordered = FALSE) boxProfileItem(title, description)
... |
any element such as boxProfileItem. |
image |
profile image, if any. |
title |
item title. |
subtitle |
subtitle. |
bordered |
Whether the container should have a border or not. FALSE by default. |
description |
item info. |
David Granjon, [email protected]
# Box with boxProfile if (interactive()) { library(shiny) library(shinydashboard) library(shinydashboardPlus) shinyApp( ui = dashboardPage( dashboardHeader(), dashboardSidebar(), dashboardBody( box( title = "Box with profile", status = "primary", boxProfile( image = "https://adminlte.io/themes/AdminLTE/dist/img/user4-128x128.jpg", title = "Nina Mcintire", subtitle = "Software Engineer", bordered = TRUE, boxProfileItem( title = "Followers", description = 1322 ), boxProfileItem( title = "Following", description = 543 ), boxProfileItem( title = "Friends", description = 13287 ) ) ) ), title = "boxProfile" ), server = function(input, output) { } ) }
# Box with boxProfile if (interactive()) { library(shiny) library(shinydashboard) library(shinydashboardPlus) shinyApp( ui = dashboardPage( dashboardHeader(), dashboardSidebar(), dashboardBody( box( title = "Box with profile", status = "primary", boxProfile( image = "https://adminlte.io/themes/AdminLTE/dist/img/user4-128x128.jpg", title = "Nina Mcintire", subtitle = "Software Engineer", bordered = TRUE, boxProfileItem( title = "Followers", description = 1322 ), boxProfileItem( title = "Following", description = 543 ), boxProfileItem( title = "Friends", description = 13287 ) ) ) ), title = "boxProfile" ), server = function(input, output) { } ) }
boxSidebar is inserted in the sidebar slot of box.
updateBoxSidebar toggle a boxSidebar on the client.
boxSidebar( ..., id = NULL, width = 50, background = "#333a40", startOpen = FALSE, icon = shiny::icon("gears") ) updateBoxSidebar(id, session = shiny::getDefaultReactiveDomain())
boxSidebar( ..., id = NULL, width = 50, background = "#333a40", startOpen = FALSE, icon = shiny::icon("gears") ) updateBoxSidebar(id, session = shiny::getDefaultReactiveDomain())
... |
Sidebar content. |
id |
Sidebar id. |
width |
Sidebar opening width in percentage. 50% by default, means the card sidebar will take 50 A numeric value between 25 and 100. |
background |
Sidebar background color. Dark by default. Expect a HEX code. |
startOpen |
Whether the sidebar is open at start. FALSE by default. |
icon |
Sidebar icon. Expect |
session |
Shiny session object. |
# Toggle a box sidebar if (interactive()) { library(shiny) library(shinydashboard) library(shinydashboardPlus) shinyApp( ui = dashboardPage( header = dashboardHeader(), body = dashboardBody( box( title = "Update box sidebar", closable = TRUE, width = 12, height = "500px", solidHeader = FALSE, collapsible = TRUE, actionButton("update", "Toggle card sidebar"), sidebar = boxSidebar( id = "mycardsidebar", p("Sidebar Content") ) ) ), sidebar = dashboardSidebar() ), server = function(input, output, session) { observe(print(input$mycardsidebar)) observeEvent(input$update, { updateBoxSidebar("mycardsidebar") }) } ) }
# Toggle a box sidebar if (interactive()) { library(shiny) library(shinydashboard) library(shinydashboardPlus) shinyApp( ui = dashboardPage( header = dashboardHeader(), body = dashboardBody( box( title = "Update box sidebar", closable = TRUE, width = 12, height = "500px", solidHeader = FALSE, collapsible = TRUE, actionButton("update", "Toggle card sidebar"), sidebar = boxSidebar( id = "mycardsidebar", p("Sidebar Content") ) ) ), sidebar = dashboardSidebar() ), server = function(input, output, session) { observe(print(input$mycardsidebar)) observeEvent(input$update, { updateBoxSidebar("mycardsidebar") }) } ) }
carousel creates a carousel container to display media content.
carouselItem creates a carousel item to insert in a carousel.
carousel(..., id, indicators = TRUE, width = 6, .list = NULL) carouselItem(..., caption = NULL, active = FALSE)
carousel(..., id, indicators = TRUE, width = 6, .list = NULL) carouselItem(..., caption = NULL, active = FALSE)
... |
Element such as images, iframe, ... |
id |
Carousel id. Must be unique. |
indicators |
Whether to display left and right indicators. |
width |
Carousel width. 6 by default. |
.list |
Should you need to pass carouselItem via lapply or similar, put these item here instead of passing them in ... |
caption |
Item caption. |
active |
Whether the item is active or not at start. |
David Granjon, [email protected]
if (interactive()) { library(shiny) library(shinydashboard) library(shinydashboardPlus) shinyApp( ui = dashboardPage( header = dashboardHeader(), sidebar = dashboardSidebar(), body = dashboardBody( carousel( id = "mycarousel", carouselItem( caption = "Item 1", tags$img(src = "https://placehold.it/900x500/3c8dbc/ffffff&text=I+Love+Bootstrap") ), carouselItem( caption = "Item 2", tags$img(src = "https://placehold.it/900x500/39CCCC/ffffff&text=I+Love+Bootstrap") ) ) ), title = "Carousel" ), server = function(input, output) { } ) }
if (interactive()) { library(shiny) library(shinydashboard) library(shinydashboardPlus) shinyApp( ui = dashboardPage( header = dashboardHeader(), sidebar = dashboardSidebar(), body = dashboardBody( carousel( id = "mycarousel", carouselItem( caption = "Item 1", tags$img(src = "https://placehold.it/900x500/3c8dbc/ffffff&text=I+Love+Bootstrap") ), carouselItem( caption = "Item 2", tags$img(src = "https://placehold.it/900x500/39CCCC/ffffff&text=I+Love+Bootstrap") ) ) ), title = "Carousel" ), server = function(input, output) { } ) }
Create a badge. It may be inserted in any element like inside a actionButton or a dashboardSidebar.
dashboardBadge(..., color)
dashboardBadge(..., color)
... |
Any html text element. |
color |
label color. See below:
|
David Granjon, [email protected]
if (interactive()) { library(shiny) library(shinydashboard) library(shinydashboardPlus) shinyApp( ui = dashboardPage( dashboardHeader(), dashboardSidebar(), dashboardBody( dashboardBadge("Badge 1", color = "blue"), actionButton( inputId = "badge", label = "Hello", icon = NULL, width = NULL, dashboardBadge(1, color = "orange") ) ) ), server = function(input, output) { } ) }
if (interactive()) { library(shiny) library(shinydashboard) library(shinydashboardPlus) shinyApp( ui = dashboardPage( dashboardHeader(), dashboardSidebar(), dashboardBody( dashboardBadge("Badge 1", color = "blue"), actionButton( inputId = "badge", label = "Hello", icon = NULL, width = NULL, dashboardBadge(1, color = "orange") ) ) ), server = function(input, output) { } ) }
dashboardControlbar create a right sidebar container.
updateControlbar allows to toggle a dashboardControlbar.
controlbarMenu is a tabset panel for the dashboardControlbar.
controlbarItem is a tabPanel for the controlbarMenu.
updateControlbarMenu allows to programmatically change the currently selected controlbarItem on the client.
dashboardControlbar( ..., id = NULL, disable = FALSE, width = 230, collapsed = TRUE, overlay = TRUE, skin = "dark", .list = NULL ) updateControlbar(id, session = shiny::getDefaultReactiveDomain()) controlbarMenu(..., id = NULL, selected = NULL) controlbarItem(title, ..., value = title, icon = NULL) updateControlbarMenu( id, selected = NULL, session = shiny::getDefaultReactiveDomain() )
dashboardControlbar( ..., id = NULL, disable = FALSE, width = 230, collapsed = TRUE, overlay = TRUE, skin = "dark", .list = NULL ) updateControlbar(id, session = shiny::getDefaultReactiveDomain()) controlbarMenu(..., id = NULL, selected = NULL) controlbarItem(title, ..., value = title, icon = NULL) updateControlbarMenu( id, selected = NULL, session = shiny::getDefaultReactiveDomain() )
... |
slot for controlbarMenu. Not compatible with .items. |
id |
Controlbar id. |
disable |
If |
width |
Sidebar width in pixels. Numeric value expected. 230 by default. |
collapsed |
Whether the control bar on the right side is collapsed or not at start. TRUE by default. |
overlay |
Whether the sidebar covers the content when expanded. Default to TRUE. |
skin |
background color: "dark" or "light". |
.list |
Pass element here if you do not want to embed them in panels. Not compatible with ... |
session |
Shiny session object. |
selected |
Item to select. |
title |
Display title for tab |
value |
The value that should be sent when |
icon |
Optional icon to appear on the tab. This attribute is only
valid when using a |
Until a maximum of 5 controlbarItem! AdminLTE 2 does not support more panels.
David Granjon, [email protected]
# Controlbar example if (interactive()) { library(shiny) library(shinydashboard) library(shinydashboardPlus) shinyApp( ui = dashboardPage( header = dashboardHeader(), sidebar = dashboardSidebar(), body = dashboardBody(), controlbar = dashboardControlbar( skin = "dark", controlbarMenu( id = "menu", controlbarItem( "Tab 1", "Welcome to tab 1" ), controlbarItem( "Tab 2", "Welcome to tab 2" ) ) ), title = "Right Sidebar" ), server = function(input, output) { } ) } # Toggle the dashboard controlbar if (interactive()) { library(shiny) library(shinydashboard) library(shinydashboardPlus) shinyApp( ui = dashboardPage( header = dashboardHeader(), sidebar = dashboardSidebar(), body = dashboardBody( actionButton(inputId = "controlbarToggle", label = "Toggle Controlbar") ), controlbar = dashboardControlbar(id = "controlbar") ), server = function(input, output, session) { observeEvent(input$controlbar, { if (input$controlbar) { showModal(modalDialog( title = "Alert", "The controlbar is opened.", easyClose = TRUE, footer = NULL )) } }) observeEvent(input$controlbarToggle, { updateControlbar("controlbar") }) observe({ print(input$controlbar) }) } ) } # controlbar with controlbarMenu if (interactive()) { library(shiny) library(shinydashboard) library(shinydashboardPlus) shinyApp( ui = dashboardPage( header = dashboardHeader(), sidebar = dashboardSidebar(), body = dashboardBody(), controlbar = dashboardControlbar( id = "controlbar", controlbarMenu( id = "menu", controlbarItem( "Tab 1", "Welcome to tab 1" ), controlbarItem( "Tab 2", "Welcome to tab 2" ) ) ) ), server = function(input, output, session) { observeEvent(input$menu, { showModal(modalDialog( title = "Alert", sprintf(" %s is active", input$menu), easyClose = TRUE, footer = NULL )) }) } ) } # Update a controlbar menu if (interactive()) { library(shiny) library(shinydashboard) library(shinydashboardPlus) shinyApp( ui = dashboardPage( header = dashboardHeader(), sidebar = dashboardSidebar(), body = dashboardBody( radioButtons("controller", "Controller", choices = c(1, 2, 3)) ), controlbar = dashboardControlbar( id = "controlbar", controlbarMenu( id = "menu", controlbarItem( paste0("Tab", 1), paste("Welcome to tab", 1) ), controlbarItem( paste0("Tab", 2), paste("Welcome to tab", 2) ), controlbarItem( paste0("Tab", 3), paste("Welcome to tab", 3) ) ) ) ), server = function(input, output, session) { observeEvent(input$controller, { updateControlbarMenu( "menu", selected = paste0("Tab", input$controller) ) }) } ) }
# Controlbar example if (interactive()) { library(shiny) library(shinydashboard) library(shinydashboardPlus) shinyApp( ui = dashboardPage( header = dashboardHeader(), sidebar = dashboardSidebar(), body = dashboardBody(), controlbar = dashboardControlbar( skin = "dark", controlbarMenu( id = "menu", controlbarItem( "Tab 1", "Welcome to tab 1" ), controlbarItem( "Tab 2", "Welcome to tab 2" ) ) ), title = "Right Sidebar" ), server = function(input, output) { } ) } # Toggle the dashboard controlbar if (interactive()) { library(shiny) library(shinydashboard) library(shinydashboardPlus) shinyApp( ui = dashboardPage( header = dashboardHeader(), sidebar = dashboardSidebar(), body = dashboardBody( actionButton(inputId = "controlbarToggle", label = "Toggle Controlbar") ), controlbar = dashboardControlbar(id = "controlbar") ), server = function(input, output, session) { observeEvent(input$controlbar, { if (input$controlbar) { showModal(modalDialog( title = "Alert", "The controlbar is opened.", easyClose = TRUE, footer = NULL )) } }) observeEvent(input$controlbarToggle, { updateControlbar("controlbar") }) observe({ print(input$controlbar) }) } ) } # controlbar with controlbarMenu if (interactive()) { library(shiny) library(shinydashboard) library(shinydashboardPlus) shinyApp( ui = dashboardPage( header = dashboardHeader(), sidebar = dashboardSidebar(), body = dashboardBody(), controlbar = dashboardControlbar( id = "controlbar", controlbarMenu( id = "menu", controlbarItem( "Tab 1", "Welcome to tab 1" ), controlbarItem( "Tab 2", "Welcome to tab 2" ) ) ) ), server = function(input, output, session) { observeEvent(input$menu, { showModal(modalDialog( title = "Alert", sprintf(" %s is active", input$menu), easyClose = TRUE, footer = NULL )) }) } ) } # Update a controlbar menu if (interactive()) { library(shiny) library(shinydashboard) library(shinydashboardPlus) shinyApp( ui = dashboardPage( header = dashboardHeader(), sidebar = dashboardSidebar(), body = dashboardBody( radioButtons("controller", "Controller", choices = c(1, 2, 3)) ), controlbar = dashboardControlbar( id = "controlbar", controlbarMenu( id = "menu", controlbarItem( paste0("Tab", 1), paste("Welcome to tab", 1) ), controlbarItem( paste0("Tab", 2), paste("Welcome to tab", 2) ), controlbarItem( paste0("Tab", 3), paste("Welcome to tab", 3) ) ) ) ), server = function(input, output, session) { observeEvent(input$controller, { updateControlbarMenu( "menu", selected = paste0("Tab", input$controller) ) }) } ) }
A dashboard header can be left blank, or it can include dropdown menu items on the right side.
dashboardHeader( ..., title = NULL, titleWidth = NULL, disable = FALSE, .list = NULL, leftUi = NULL, controlbarIcon = shiny::icon("gears"), fixed = FALSE )
dashboardHeader( ..., title = NULL, titleWidth = NULL, disable = FALSE, .list = NULL, leftUi = NULL, controlbarIcon = shiny::icon("gears"), fixed = FALSE )
... |
Items to put in the header. Should be |
title |
An optional title to show in the header bar.. By default, this
will also be used as the title shown in the browser's title bar. If you
want that to be different from the text in the dashboard header bar, set
the |
titleWidth |
The width of the title area. This must either be a number which specifies the width in pixels, or a string that specifies the width in CSS units. |
disable |
If |
.list |
An optional list containing items to put in the header. Same as
the |
leftUi |
Items that will appear on the left part of the navbar. Should be wrapped in a tagList. |
controlbarIcon |
Customize the trigger icon of the right sidebar. |
fixed |
Whether the navbar is fixed-top or not. FALSE by default. |
We do not recommend to insert shiny input elements (such as sliderInput)
in the left menu, since they will not be well displayed. Instead, wrap them in a
dropdownBlock
if (interactive()) { library(shiny) library(shinyWidgets) library(shinydashboard) library(shinydashboardPlus) shinyApp( ui = dashboardPage( header = dashboardHeader( leftUi = tagList( dropdownBlock( id = "mydropdown", title = "Dropdown 1", icon = icon("sliders"), sliderInput( inputId = "n", label = "Number of observations", min = 10, max = 100, value = 30 ), prettyToggle( inputId = "na", label_on = "NAs kept", label_off = "NAs removed", icon_on = icon("check"), icon_off = icon("trash-can") ) ), dropdownBlock( id = "mydropdown2", title = "Dropdown 2", icon = icon("sliders"), prettySwitch( inputId = "switch4", label = "Fill switch with status:", fill = TRUE, status = "primary" ), prettyCheckboxGroup( inputId = "checkgroup2", label = "Click me!", thick = TRUE, choices = c("Click me !", "Me !", "Or me !"), animation = "pulse", status = "info" ) ) ), dropdownMenu( type = "tasks", badgeStatus = "danger", taskItem(value = 20, color = "aqua", "Refactor code"), taskItem(value = 40, color = "green", "Design new layout"), taskItem(value = 60, color = "yellow", "Another task"), taskItem(value = 80, color = "red", "Write documentation") ) ), sidebar = dashboardSidebar(), body = dashboardBody( setShadow(class = "dropdown-menu") ), title = "DashboardPage" ), server = function(input, output) { } ) }
if (interactive()) { library(shiny) library(shinyWidgets) library(shinydashboard) library(shinydashboardPlus) shinyApp( ui = dashboardPage( header = dashboardHeader( leftUi = tagList( dropdownBlock( id = "mydropdown", title = "Dropdown 1", icon = icon("sliders"), sliderInput( inputId = "n", label = "Number of observations", min = 10, max = 100, value = 30 ), prettyToggle( inputId = "na", label_on = "NAs kept", label_off = "NAs removed", icon_on = icon("check"), icon_off = icon("trash-can") ) ), dropdownBlock( id = "mydropdown2", title = "Dropdown 2", icon = icon("sliders"), prettySwitch( inputId = "switch4", label = "Fill switch with status:", fill = TRUE, status = "primary" ), prettyCheckboxGroup( inputId = "checkgroup2", label = "Click me!", thick = TRUE, choices = c("Click me !", "Me !", "Or me !"), animation = "pulse", status = "info" ) ) ), dropdownMenu( type = "tasks", badgeStatus = "danger", taskItem(value = 20, color = "aqua", "Refactor code"), taskItem(value = 40, color = "green", "Design new layout"), taskItem(value = 60, color = "yellow", "Another task"), taskItem(value = 80, color = "red", "Write documentation") ) ), sidebar = dashboardSidebar(), body = dashboardBody( setShadow(class = "dropdown-menu") ), title = "DashboardPage" ), server = function(input, output) { } ) }
Create a label
dashboardLabel(..., status, style = "default")
dashboardLabel(..., status, style = "default")
... |
any text. |
status |
label status. Valid statuses are defined as follows:
|
style |
label border style: "default" (rounded angles), "circle" or "square". |
David Granjon, [email protected]
if (interactive()) { library(shiny) library(shinydashboard) library(shinydashboardPlus) shinyApp( ui = dashboardPage( dashboardHeader(), dashboardSidebar(), dashboardBody( dashboardLabel("Label 1", status = "info"), dashboardLabel("Label 2", status = "danger", style = "circle"), dashboardLabel("Label 3", status = "success", style = "square") ) ), server = function(input, output) { } ) }
if (interactive()) { library(shiny) library(shinydashboard) library(shinydashboardPlus) shinyApp( ui = dashboardPage( dashboardHeader(), dashboardSidebar(), dashboardBody( dashboardLabel("Label 1", status = "info"), dashboardLabel("Label 2", status = "danger", style = "circle"), dashboardLabel("Label 3", status = "success", style = "square") ) ), server = function(input, output) { } ) }
This creates a dashboard page for use in a Shiny app.
dashboardPage( header, sidebar, body, controlbar = NULL, footer = NULL, title = NULL, skin = c("blue", "blue-light", "black", "black-light", "purple", "purple-light", "green", "green-light", "red", "red-light", "yellow", "yellow-light", "midnight"), freshTheme = NULL, preloader = NULL, md = FALSE, options = NULL, scrollToTop = FALSE )
dashboardPage( header, sidebar, body, controlbar = NULL, footer = NULL, title = NULL, skin = c("blue", "blue-light", "black", "black-light", "purple", "purple-light", "green", "green-light", "red", "red-light", "yellow", "yellow-light", "midnight"), freshTheme = NULL, preloader = NULL, md = FALSE, options = NULL, scrollToTop = FALSE )
header |
A header created by |
sidebar |
A sidebar created by |
body |
A body created by |
controlbar |
A right sidebar created by dashboardControlbar. NULL by default. |
footer |
A footer created by dashboardFooter. |
title |
A title to display in the browser's title bar. If no value is
provided, it will try to extract the title from the
|
skin |
A color theme. See https://adminlte.io/themes/AdminLTE/pages/UI/general.html. If the skin is light, the sidebar will have a light background. Not compatible with freshTheme. |
freshTheme |
A skin powered by the fresh package. Not compatible with skin. See https://dreamrs.github.io/fresh/articles/vars-shinydashboard.html. |
preloader |
shinydashboardPlus uses waiter (see https://waiter.john-coene.com/#/).
Pass a list like |
md |
Whether to enable material design. Experimental... |
options |
Extra option to overwrite the vanilla AdminLTE configuration. See https://adminlte.io/themes/AdminLTE/documentation/index.html#adminlte-options. Expect a list. |
scrollToTop |
Whether to display a scroll to top button whenever the page height is too large. Default to FALSE. |
dashboardHeader
, dashboardSidebar
,
dashboardBody
.
if (interactive()) { library(shiny) library(shinydashboard) library(shinydashboardPlus) library(fresh) shinyApp( ui = dashboardPage( freshTheme = create_theme( adminlte_color( light_blue = "#55e7ff", blue = "#2011a2", navy = "#201148", red = "#ff34b3" ), adminlte_sidebar( dark_bg = "#D8DEE9", dark_hover_bg = "#81A1C1", dark_color = "#2E3440" ), adminlte_global( content_bg = "#FFF", box_bg = "#D8DEE9", info_box_bg = "#D8DEE9" ) ), options = list(sidebarExpandOnHover = TRUE), header = dashboardHeader(), sidebar = dashboardSidebar(), body = dashboardBody( box(background = "red"), box(background = "blue"), box(background = "navy") ), controlbar = dashboardControlbar(), title = "DashboardPage" ), server = function(input, output) { } ) }
if (interactive()) { library(shiny) library(shinydashboard) library(shinydashboardPlus) library(fresh) shinyApp( ui = dashboardPage( freshTheme = create_theme( adminlte_color( light_blue = "#55e7ff", blue = "#2011a2", navy = "#201148", red = "#ff34b3" ), adminlte_sidebar( dark_bg = "#D8DEE9", dark_hover_bg = "#81A1C1", dark_color = "#2E3440" ), adminlte_global( content_bg = "#FFF", box_bg = "#D8DEE9", info_box_bg = "#D8DEE9" ) ), options = list(sidebarExpandOnHover = TRUE), header = dashboardHeader(), sidebar = dashboardSidebar(), body = dashboardBody( box(background = "red"), box(background = "blue"), box(background = "navy") ), controlbar = dashboardControlbar(), title = "DashboardPage" ), server = function(input, output) { } ) }
A dashboard sidebar typically contains a sidebarMenu
, although
it may also contain a sidebarSearchForm
, or other Shiny inputs.
updateSidebar allows to toggle a dashboardSidebar on the client.
dashboardSidebar( ..., disable = FALSE, width = NULL, collapsed = FALSE, minified = TRUE, id = NULL ) updateSidebar(id, session = shiny::getDefaultReactiveDomain())
dashboardSidebar( ..., disable = FALSE, width = NULL, collapsed = FALSE, minified = TRUE, id = NULL ) updateSidebar(id, session = shiny::getDefaultReactiveDomain())
... |
Items to put in the sidebar. |
disable |
If |
width |
The width of the sidebar. This must either be a number which specifies the width in pixels, or a string that specifies the width in CSS units. |
collapsed |
If |
minified |
Whether to slightly close the sidebar but still show item icons. Default to TRUE. |
id |
Sidebar id. |
session |
Shiny session object. |
if (interactive()) { library(shiny) library(shinydashboard) library(shinydashboardPlus) shinyApp( ui = dashboardPage( header = dashboardHeader(), sidebar = dashboardSidebar(id = "sidebar"), body = dashboardBody( actionButton(inputId = "sidebarToggle", label = "Toggle Sidebar") ) ), server = function(input, output, session) { observeEvent(input$sidebar, { if (input$sidebar) { showModal(modalDialog( title = "Alert", "The sidebar is opened.", easyClose = TRUE, footer = NULL )) } }) observeEvent(input$sidebarToggle, { updateSidebar("sidebar") }) observe({ print(input$sidebar) }) } ) }
if (interactive()) { library(shiny) library(shinydashboard) library(shinydashboardPlus) shinyApp( ui = dashboardPage( header = dashboardHeader(), sidebar = dashboardSidebar(id = "sidebar"), body = dashboardBody( actionButton(inputId = "sidebarToggle", label = "Toggle Sidebar") ) ), server = function(input, output, session) { observeEvent(input$sidebar, { if (input$sidebar) { showModal(modalDialog( title = "Alert", "The sidebar is opened.", easyClose = TRUE, footer = NULL )) } }) observeEvent(input$sidebarToggle, { updateSidebar("sidebar") }) observe({ print(input$sidebar) }) } ) }
Create a dashboard user profile.
dashboardUser( ..., name = NULL, image = NULL, title = NULL, subtitle = NULL, footer = NULL )
dashboardUser( ..., name = NULL, image = NULL, title = NULL, subtitle = NULL, footer = NULL )
... |
Body content. Slot for dashboardUserItem. |
name |
User name. |
image |
User profile picture. |
title |
A title. |
subtitle |
A subtitle. |
footer |
Footer is any. |
userOutput
and renderUser
for
dynamically-generating dashboardUser
.
if (interactive()) { library(shiny) library(shinyWidgets) library(shinydashboard) library(shinydashboardPlus) shinyApp( ui = dashboardPage( header = dashboardHeader(userOutput("user")), sidebar = dashboardSidebar(), body = dashboardBody(), title = "DashboardPage" ), server = function(input, output) { output$user <- renderUser({ dashboardUser( name = "Divad Nojnarg", image = "https://adminlte.io/themes/AdminLTE/dist/img/user2-160x160.jpg", title = "shinydashboardPlus", subtitle = "Author", footer = p("The footer", class = "text-center"), fluidRow( dashboardUserItem( width = 6, socialButton( href = "https://dropbox.com", icon = icon("dropbox") ) ), dashboardUserItem( width = 6, socialButton( href = "https://github.com", icon = icon("github") ) ) ) ) }) } ) }
if (interactive()) { library(shiny) library(shinyWidgets) library(shinydashboard) library(shinydashboardPlus) shinyApp( ui = dashboardPage( header = dashboardHeader(userOutput("user")), sidebar = dashboardSidebar(), body = dashboardBody(), title = "DashboardPage" ), server = function(input, output) { output$user <- renderUser({ dashboardUser( name = "Divad Nojnarg", image = "https://adminlte.io/themes/AdminLTE/dist/img/user2-160x160.jpg", title = "shinydashboardPlus", subtitle = "Author", footer = p("The footer", class = "text-center"), fluidRow( dashboardUserItem( width = 6, socialButton( href = "https://dropbox.com", icon = icon("dropbox") ) ), dashboardUserItem( width = 6, socialButton( href = "https://github.com", icon = icon("github") ) ) ) ) }) } ) }
This can be inserted in a dashboardUser
.
dashboardUserItem(item, width)
dashboardUserItem(item, width)
item |
HTML Tag. |
width |
Item width between 1 and 12. |
Create a dropdown block to place in a dashboard header
dropdownBlock(..., id, icon = NULL, title = NULL, badgeStatus = "danger")
dropdownBlock(..., id, icon = NULL, title = NULL, badgeStatus = "danger")
... |
Items to put in the menu. |
id |
Dropdown block id. |
icon |
An icon to display in the header. Expect |
title |
Dropdown block title. |
badgeStatus |
Dropdown badge status. |
dashboardHeader
for example usage.
flipBox creates a box that flips from back to front and inversely
updateFlipBox programmatically toggles a flipBox from the server.
flipBox(id, front, back, trigger = c("click", "hover"), width = 6) updateFlipBox(id, session = shiny::getDefaultReactiveDomain())
flipBox(id, front, back, trigger = c("click", "hover"), width = 6) updateFlipBox(id, session = shiny::getDefaultReactiveDomain())
id |
flipBox id. |
front |
ui for the front of the flip box |
back |
ui for the back of the flip box |
trigger |
How to trigger rotate effect. Either click or hover. Default to click. |
width |
flipbox width. Between 1 and 12. |
session |
Shiny session object. |
To access the state of the flipbox use the input alias input$<id>
.
For example, if your flipBox's id is myawesomeflipbox, you can access its state via
input$myawesomeflipbox
where TRUE corresponds to the front, FALSE to the back.
if (interactive()) { library(shiny) library(shinydashboard) library(shinydashboardPlus) shinyApp( ui = dashboardPage( dashboardHeader(), dashboardSidebar(), dashboardBody( fluidRow( column( width = 6, uiOutput("active_side"), flipBox( id = "myflipbox", trigger = "hover", width = 12, front = div( class = "text-center", h1("Flip on hover"), img( src = "https://image.flaticon.com/icons/svg/149/149076.svg", height = "300px", width = "100%" ) ), back = div( class = "text-center", height = "300px", width = "100%", h1("Flip on hover"), p("More information....") ) ) ), column( width = 6, uiOutput("active_side_2"), flipBox( id = "myflipbox2", width = 12, front = div( class = "text-center", h1("Flip on click"), img( src = "https://image.flaticon.com/icons/svg/149/149076.svg", height = "300px", width = "100%" ) ), back = div( class = "text-center", height = "300px", width = "100%", h1("Flip on click"), p("More information....") ) ) ) ) ) ), server = function(input, output, session) { output$active_side <- renderUI({ side <- if (input$myflipbox) "front" else "back" dashboardBadge(side, color = "blue") }) output$active_side_2<- renderUI({ side <- if (input$myflipbox2) "front" else "back" dashboardBadge(side, color = "blue") }) } ) } if (interactive()) { library(shiny) library(shinydashboard) library(shinydashboardPlus) shinyApp( ui = dashboardPage( dashboardHeader(), dashboardSidebar(), dashboardBody( actionButton("toggle", "Toggle flip box"), uiOutput("active_side"), flipBox( id = "myflipbox", front = div( class = "text-center", img( src = "https://image.flaticon.com/icons/svg/149/149076.svg", height = "300px", width = "100%" ) ), back = div( class = "text-center", height = "300px", width = "100%", h1("Details...."), p("More information....") ) ) ) ), server = function(input, output, session) { output$active_side <- renderUI({ side <- if (input$myflipbox) "front" else "back" dashboardBadge(side, color = "blue") }) observeEvent(input$toggle, { updateFlipBox("myflipbox") }) } ) }
if (interactive()) { library(shiny) library(shinydashboard) library(shinydashboardPlus) shinyApp( ui = dashboardPage( dashboardHeader(), dashboardSidebar(), dashboardBody( fluidRow( column( width = 6, uiOutput("active_side"), flipBox( id = "myflipbox", trigger = "hover", width = 12, front = div( class = "text-center", h1("Flip on hover"), img( src = "https://image.flaticon.com/icons/svg/149/149076.svg", height = "300px", width = "100%" ) ), back = div( class = "text-center", height = "300px", width = "100%", h1("Flip on hover"), p("More information....") ) ) ), column( width = 6, uiOutput("active_side_2"), flipBox( id = "myflipbox2", width = 12, front = div( class = "text-center", h1("Flip on click"), img( src = "https://image.flaticon.com/icons/svg/149/149076.svg", height = "300px", width = "100%" ) ), back = div( class = "text-center", height = "300px", width = "100%", h1("Flip on click"), p("More information....") ) ) ) ) ) ), server = function(input, output, session) { output$active_side <- renderUI({ side <- if (input$myflipbox) "front" else "back" dashboardBadge(side, color = "blue") }) output$active_side_2<- renderUI({ side <- if (input$myflipbox2) "front" else "back" dashboardBadge(side, color = "blue") }) } ) } if (interactive()) { library(shiny) library(shinydashboard) library(shinydashboardPlus) shinyApp( ui = dashboardPage( dashboardHeader(), dashboardSidebar(), dashboardBody( actionButton("toggle", "Toggle flip box"), uiOutput("active_side"), flipBox( id = "myflipbox", front = div( class = "text-center", img( src = "https://image.flaticon.com/icons/svg/149/149076.svg", height = "300px", width = "100%" ) ), back = div( class = "text-center", height = "300px", width = "100%", h1("Details...."), p("More information....") ) ) ) ), server = function(input, output, session) { output$active_side <- renderUI({ side <- if (input$myflipbox) "front" else "back" dashboardBadge(side, color = "blue") }) observeEvent(input$toggle, { updateFlipBox("myflipbox") }) } ) }
When a section is still work in progress or a computation is running
loadingState()
loadingState()
Loading state can be programmatically used when a conputation is running for instance.
David Granjon, [email protected]
if (interactive()) { library(shiny) library(shinydashboard) library(shinydashboardPlus) shinyApp( ui = dashboardPage( dashboardHeader(), dashboardSidebar(), dashboardBody( box( title = "loading spinner", loadingState() ) ), title = "Loading State" ), server = function(input, output) { } ) }
if (interactive()) { library(shiny) library(shinydashboard) library(shinydashboardPlus) shinyApp( ui = dashboardPage( dashboardHeader(), dashboardSidebar(), dashboardBody( box( title = "loading spinner", loadingState() ) ), title = "Loading State" ), server = function(input, output) { } ) }
Custom messageItem
messageItem( from, message, icon = shiny::icon("user"), time = NULL, href = NULL, inputId = NULL )
messageItem( from, message, icon = shiny::icon("user"), time = NULL, href = NULL, inputId = NULL )
from |
Who the message is from. |
message |
Text of the message. |
icon |
An icon tag, created by |
time |
String representing the time the message was sent. Any string may be used. For example, it could be a relative date/time like "5 minutes", "today", or "12:30pm yesterday", or an absolute time, like "2014-12-01 13:45". If NULL, no time will be displayed. |
href |
An optional URL to link to. |
inputId |
If not NULL, this item behaves like an action button. |
Custom notificationItem
notificationItem( text, icon = shiny::icon("triangle-exclamation"), status = "success", href = NULL, inputId = NULL )
notificationItem( text, icon = shiny::icon("triangle-exclamation"), status = "success", href = NULL, inputId = NULL )
text |
The notification text. |
icon |
An icon tag, created by |
status |
The status of the item This determines the item's background color. Valid statuses are listed in validStatuses. |
href |
An optional URL to link to. |
inputId |
If not NULL, this item behaves like an action button. |
productList creates a container to display commercial items in an elegant container. Insert in a box.
productListItem creates a product item to insert in productList.
productList(...) productListItem(..., image = NULL, title = NULL, subtitle = NULL, color = NULL)
productList(...) productListItem(..., image = NULL, title = NULL, subtitle = NULL, color = NULL)
... |
product description. |
image |
image url, if any. |
title |
product name. |
subtitle |
product price. |
color |
price color: see here for a list of valid colors https://adminlte.io/themes/AdminLTE/pages/UI/general.html. See below:
|
David Granjon, [email protected]
# Box with productList if (interactive()) { library(shiny) library(shinydashboard) library(shinydashboardPlus) shinyApp( ui = dashboardPage( dashboardHeader(), dashboardSidebar(), dashboardBody( box( title = "Product List", status = "primary", productList( productListItem( image = "https://www.pngmart.com/files/1/Haier-TV-PNG.png", title = "Samsung TV", subtitle = "$1800", color = "yellow", "This is an amazing TV, but I don't like TV!" ), productListItem( image = "https://upload.wikimedia.org/wikipedia/commons/7/77/IMac_Pro.svg", title = "Imac 27", subtitle = "$4999", color = "red", "This is were I spend most of my time!" ) ) ) ), title = "Product List" ), server = function(input, output) { } ) }
# Box with productList if (interactive()) { library(shiny) library(shinydashboard) library(shinydashboardPlus) shinyApp( ui = dashboardPage( dashboardHeader(), dashboardSidebar(), dashboardBody( box( title = "Product List", status = "primary", productList( productListItem( image = "https://www.pngmart.com/files/1/Haier-TV-PNG.png", title = "Samsung TV", subtitle = "$1800", color = "yellow", "This is an amazing TV, but I don't like TV!" ), productListItem( image = "https://upload.wikimedia.org/wikipedia/commons/7/77/IMac_Pro.svg", title = "Imac 27", subtitle = "$4999", color = "red", "This is were I spend most of my time!" ) ) ) ), title = "Product List" ), server = function(input, output) { } ) }
This creates a vertical progress bar.
progressBar( value, min = 0, max = 100, vertical = FALSE, striped = FALSE, animated = FALSE, status = "primary", size = NULL, label = NULL )
progressBar( value, min = 0, max = 100, vertical = FALSE, striped = FALSE, animated = FALSE, status = "primary", size = NULL, label = NULL )
value |
Progress bar value. Must be between min and max. |
min |
Progress bar minimum value (0 by default). |
max |
Progress bar maximum value (100 by default). |
vertical |
Progress vertical layout. Default to FALSE |
striped |
Whether the progress is striped or not. FALSE by default. |
animated |
Whether the progress is active or not. FALSE by default. Works only if striped is TRUE. |
status |
Progress bar status. "primary" by default or "warning", "info", "danger" or "success". Valid statuses are defined as follows:
|
size |
Progress bar size. NULL by default: "sm", "xs" or "xxs" also available. |
label |
Progress label. NULL by default. |
David Granjon, [email protected]
if (interactive()) { library(shiny) library(shinydashboard) library(shinydashboardPlus) shinyApp( ui = dashboardPage( header = dashboardHeader(), sidebar = dashboardSidebar(), body = dashboardBody( box( title = "Horizontal", progressBar( value = 10, striped = TRUE, animated = TRUE, label = "10%" ), progressBar( value = 50, status = "warning", size = "xs" ), progressBar( value = 20, status = "danger", size = "sm" ) ), box( title = "Vertical", progressBar( value = 10, striped = TRUE, animated = TRUE, vertical = TRUE ), progressBar( value = 50, status = "warning", size = "xs", vertical = TRUE ), progressBar( value = 20, status = "danger", size = "sm", vertical = TRUE ) ) ), title = "Progress bars" ), server = function(input, output) { } ) }
if (interactive()) { library(shiny) library(shinydashboard) library(shinydashboardPlus) shinyApp( ui = dashboardPage( header = dashboardHeader(), sidebar = dashboardSidebar(), body = dashboardBody( box( title = "Horizontal", progressBar( value = 10, striped = TRUE, animated = TRUE, label = "10%" ), progressBar( value = 50, status = "warning", size = "xs" ), progressBar( value = 20, status = "danger", size = "sm" ) ), box( title = "Vertical", progressBar( value = 10, striped = TRUE, animated = TRUE, vertical = TRUE ), progressBar( value = 50, status = "warning", size = "xs", vertical = TRUE ), progressBar( value = 20, status = "danger", size = "sm", vertical = TRUE ) ) ), title = "Progress bars" ), server = function(input, output) { } ) }
Create dynamic user output (server side)
renderUser(expr, env = parent.frame(), quoted = FALSE, outputArgs = list())
renderUser(expr, env = parent.frame(), quoted = FALSE, outputArgs = list())
expr |
An expression that returns a Shiny tag object, |
env |
The parent environment for the reactive expression. By default,
this is the calling environment, the same as when defining an ordinary
non-reactive expression. If |
quoted |
If it is |
outputArgs |
A list of arguments to be passed through to the implicit
call to |
userOutput
for the corresponding client side function
and examples.
Other user outputs:
userOutput()
A gallery of all components available in shinydashboardPlus.
shinydashboardPlusGallery()
shinydashboardPlusGallery()
if (interactive()) { shinydashboardPlusGallery() }
if (interactive()) { shinydashboardPlusGallery() }
Create a social button
socialButton(href, icon)
socialButton(href, icon)
href |
External link. |
icon |
social network icon: see here for valid names https://adminlte.io/themes/AdminLTE/pages/UI/buttons.html. |
David Granjon, [email protected]
if (interactive()) { library(shiny) library(shinydashboard) library(shinydashboardPlus) shinyApp( ui = dashboardPage( dashboardHeader(), dashboardSidebar(), dashboardBody( box( title = "Social Buttons", status = NULL, socialButton( href = "https://dropbox.com", icon = icon("dropbox") ), socialButton( href = "https://github.com", icon = icon("github") ) ) ), title = "Social Buttons" ), server = function(input, output) { } ) }
if (interactive()) { library(shiny) library(shinydashboard) library(shinydashboardPlus) shinyApp( ui = dashboardPage( dashboardHeader(), dashboardSidebar(), dashboardBody( box( title = "Social Buttons", status = NULL, socialButton( href = "https://dropbox.com", icon = icon("dropbox") ), socialButton( href = "https://github.com", icon = icon("github") ) ) ), title = "Social Buttons" ), server = function(input, output) { } ) }
Create a starBlock item (ideal for rating)
starBlock(value, max = 5, color = "yellow")
starBlock(value, max = 5, color = "yellow")
value |
Current score. Should be positive and lower or equal to max. |
max |
Maximum number of stars by block. |
color |
Star color: see
|
David Granjon, [email protected]
if (interactive()) { library(shiny) library(shinydashboard) library(shinydashboardPlus) shinyApp( ui = dashboardPage( dashboardHeader(), dashboardSidebar(), dashboardBody( box( title = "Star example", starBlock(5), starBlock(5, color = "olive"), starBlock(1, color = "maroon"), starBlock(3, color = "teal") ) ), title = "starBlock" ), server = function(input, output) { } ) }
if (interactive()) { library(shiny) library(shinydashboard) library(shinydashboardPlus) shinyApp( ui = dashboardPage( dashboardHeader(), dashboardSidebar(), dashboardBody( box( title = "Star example", starBlock(5), starBlock(5, color = "olive"), starBlock(1, color = "maroon"), starBlock(3, color = "teal") ) ), title = "starBlock" ), server = function(input, output) { } ) }
Custom taskItem
taskItem(text, value = 0, color = "aqua", href = NULL, inputId = NULL)
taskItem(text, value = 0, color = "aqua", href = NULL, inputId = NULL)
text |
The task text. |
value |
A percent value to use for the bar. |
color |
A color for the bar. Valid colors are listed in validColors. |
href |
An optional URL to link to. |
inputId |
If not NULL, this item behaves like an action button. |
if (interactive()) { library(shiny) library(shinydashboard) library(shinydashboardPlus) shinyApp( ui = dashboardPage( dashboardHeader( dropdownMenu( type = "tasks", badgeStatus = "danger", taskItem( inputId = "mytask", value = 20, color = "aqua", text = "Click me!" ), taskItem( value = 40, color = "green", text = "Basic item" ) ) ), dashboardSidebar(), dashboardBody(), title = "Dashboard example" ), server = function(input, output) { observeEvent(input$mytask, { showModal(modalDialog( title = "Important message", "This is an important message!" )) }) } ) }
if (interactive()) { library(shiny) library(shinydashboard) library(shinydashboardPlus) shinyApp( ui = dashboardPage( dashboardHeader( dropdownMenu( type = "tasks", badgeStatus = "danger", taskItem( inputId = "mytask", value = 20, color = "aqua", text = "Click me!" ), taskItem( value = 40, color = "green", text = "Basic item" ) ) ), dashboardSidebar(), dashboardBody(), title = "Dashboard example" ), server = function(input, output) { observeEvent(input$mytask, { showModal(modalDialog( title = "Important message", "This is an important message!" )) }) } ) }
timelineBlock creates a timeline block that may be inserted in a box or outside.
timelineLabel creates a timeline label element to highlight an event.
timelineItem creates a timeline item that contains information for a given event like the title, description, date, ...
timelineItemMedia create a specific container for images.
timelineStart indicates a starting point.
timelineEnd indicates an end point.
timelineBlock(..., reversed = TRUE, width = 6) timelineLabel(..., color = NULL) timelineItem( ..., icon = NULL, color = NULL, time = NULL, title = NULL, border = TRUE, footer = NULL ) timelineItemMedia(image = NULL, height = NULL, width = NULL) timelineStart(icon = shiny::icon("clock"), color = NULL) timelineEnd(icon = shiny::icon("hourglass-end"), color = NULL)
timelineBlock(..., reversed = TRUE, width = 6) timelineLabel(..., color = NULL) timelineItem( ..., icon = NULL, color = NULL, time = NULL, title = NULL, border = TRUE, footer = NULL ) timelineItemMedia(image = NULL, height = NULL, width = NULL) timelineStart(icon = shiny::icon("clock"), color = NULL) timelineEnd(icon = shiny::icon("hourglass-end"), color = NULL)
... |
any element. |
reversed |
Whether the timeline is reversed or not. |
width |
media width in pixels. |
color |
item color: see here for a list of valid colors https://adminlte.io/themes/AdminLTE/pages/UI/general.html. See below:
|
icon |
item icon. Expect |
time |
item date or time. |
title |
item title. |
border |
Whether to display a border between the header and the body. TRUE by default. |
footer |
item footer if any. |
image |
media url or path. |
height |
media height in pixels. |
David Granjon, [email protected]
if (interactive()) { library(shiny) library(shinydashboard) library(shinydashboardPlus) shinyApp( ui = dashboardPage( dashboardHeader(), dashboardSidebar(), dashboardBody( h3("When Reversed = TRUE, can be displayed inside a box"), box( title = "Timeline", status = "info", timelineBlock( width = 12, timelineEnd(color = "red"), timelineLabel(2018, color = "teal"), timelineItem( title = "Item 1", icon = icon("gears"), color = "olive", time = "now", footer = "Here is the footer", "This is the body" ), timelineItem( title = "Item 2", border = FALSE ), timelineLabel(2015, color = "orange"), timelineItem( title = "Item 3", icon = icon("paint-brush"), color = "maroon", timelineItemMedia(image = "https://placehold.it/150x100"), timelineItemMedia(image = "https://placehold.it/150x100") ), timelineStart(color = "purple") ) ), h3("When Reversed = FALSE, can be displayed out of a box"), timelineBlock( reversed = FALSE, timelineEnd(color = "red"), timelineLabel(2018, color = "teal"), timelineItem( title = "Item 1", icon = icon("gears"), color = "olive", time = "now", footer = "Here is the footer", "This is the body" ), timelineItem( title = "Item 2", border = FALSE ), timelineLabel(2015, color = "orange"), timelineItem( title = "Item 3", icon = icon("paint-brush"), color = "maroon", timelineItemMedia(image = "https://placehold.it/150x100"), timelineItemMedia(image = "https://placehold.it/150x100") ), timelineStart(color = "purple") ) ), title = "timelineBlock" ), server = function(input, output) { } ) }
if (interactive()) { library(shiny) library(shinydashboard) library(shinydashboardPlus) shinyApp( ui = dashboardPage( dashboardHeader(), dashboardSidebar(), dashboardBody( h3("When Reversed = TRUE, can be displayed inside a box"), box( title = "Timeline", status = "info", timelineBlock( width = 12, timelineEnd(color = "red"), timelineLabel(2018, color = "teal"), timelineItem( title = "Item 1", icon = icon("gears"), color = "olive", time = "now", footer = "Here is the footer", "This is the body" ), timelineItem( title = "Item 2", border = FALSE ), timelineLabel(2015, color = "orange"), timelineItem( title = "Item 3", icon = icon("paint-brush"), color = "maroon", timelineItemMedia(image = "https://placehold.it/150x100"), timelineItemMedia(image = "https://placehold.it/150x100") ), timelineStart(color = "purple") ) ), h3("When Reversed = FALSE, can be displayed out of a box"), timelineBlock( reversed = FALSE, timelineEnd(color = "red"), timelineLabel(2018, color = "teal"), timelineItem( title = "Item 1", icon = icon("gears"), color = "olive", time = "now", footer = "Here is the footer", "This is the body" ), timelineItem( title = "Item 2", border = FALSE ), timelineLabel(2015, color = "orange"), timelineItem( title = "Item 3", icon = icon("paint-brush"), color = "maroon", timelineItemMedia(image = "https://placehold.it/150x100"), timelineItemMedia(image = "https://placehold.it/150x100") ), timelineStart(color = "purple") ) ), title = "timelineBlock" ), server = function(input, output) { } ) }
Create a todo list container. May be included in box.
todoListItem creates a todo list item.
todoList(..., sortable = TRUE) todoListItem(..., checked = FALSE, label = NULL)
todoList(..., sortable = TRUE) todoListItem(..., checked = FALSE, label = NULL)
... |
any element such as labels, ... |
sortable |
Whether the list elements are sortable or not. |
checked |
Whether the list item is checked or not. |
label |
item label. |
David Granjon, [email protected]
if (interactive()) { library(shiny) library(shinydashboard) library(shinyjqui) library(shinydashboardPlus) shinyApp( ui = dashboardPage( dashboardHeader(), dashboardSidebar(), dashboardBody( box( "Sortable todo list demo", status = "warning", todoList( todoListItem( label = "Design a nice theme", "Some text here" ), todoListItem( label = "Make the theme responsive", "Some text here" ), todoListItem( checked = TRUE, label = "Let theme shine like a star" ) ) ), box( "Simple todo list demo", status = "warning", todoList( sortable = FALSE, todoListItem( label = "Design a nice theme", "Some text here" ), todoListItem( label = "Make the theme responsive", "Some text here" ), todoListItem( checked = TRUE, label = "Let theme shine like a star" ) ) ) ), title = "Todo Lists" ), server = function(input, output) { } ) }
if (interactive()) { library(shiny) library(shinydashboard) library(shinyjqui) library(shinydashboardPlus) shinyApp( ui = dashboardPage( dashboardHeader(), dashboardSidebar(), dashboardBody( box( "Sortable todo list demo", status = "warning", todoList( todoListItem( label = "Design a nice theme", "Some text here" ), todoListItem( label = "Make the theme responsive", "Some text here" ), todoListItem( checked = TRUE, label = "Let theme shine like a star" ) ) ), box( "Simple todo list demo", status = "warning", todoList( sortable = FALSE, todoListItem( label = "Design a nice theme", "Some text here" ), todoListItem( label = "Make the theme responsive", "Some text here" ), todoListItem( checked = TRUE, label = "Let theme shine like a star" ) ) ) ), title = "Todo Lists" ), server = function(input, output) { } ) }
userBox creates a user card.
userDescription creates a customized title tag for userBox.
userBox( ..., title = NULL, footer = NULL, status = NULL, background = NULL, width = 6, height = NULL, collapsible = TRUE, collapsed = FALSE, closable = FALSE, gradient = FALSE, boxToolSize = "sm", headerBorder = TRUE, label = NULL, dropdownMenu = NULL, sidebar = NULL, id = NULL ) userDescription( title, subtitle = NULL, image, backgroundImage = NULL, type = c(1, 2), imageElevation = NULL )
userBox( ..., title = NULL, footer = NULL, status = NULL, background = NULL, width = 6, height = NULL, collapsible = TRUE, collapsed = FALSE, closable = FALSE, gradient = FALSE, boxToolSize = "sm", headerBorder = TRUE, label = NULL, dropdownMenu = NULL, sidebar = NULL, id = NULL ) userDescription( title, subtitle = NULL, image, backgroundImage = NULL, type = c(1, 2), imageElevation = NULL )
... |
any element such as descriptionBlock. |
title |
User card title. |
footer |
Optional footer text. |
status |
The status of the item This determines the item's background color. Valid statuses are defined as follows:
Only primary, success, info, warning and danger are compatible with solidHeader! |
background |
If NULL (the default), the background of the box will be white. Otherwise, a color string. Valid colors are listed in validColors. See below:
|
width |
The width of the box, using the Bootstrap grid system. This is
used for row-based layouts. The overall width of a region is 12, so the
default valueBox width of 4 occupies 1/3 of that width. For column-based
layouts, use |
height |
The height of a box, in pixels or other CSS unit. By default the height scales automatically with the content. |
collapsible |
If TRUE, display a button in the upper right that allows the user to collapse the box. |
collapsed |
If TRUE, start collapsed. This must be used with
|
closable |
If TRUE, display a button in the upper right that allows the user to close the box. |
gradient |
Whether to allow gradient effect for the background color. Default to FALSE. |
boxToolSize |
Size of the toolbox: choose among "xs", "sm", "md", "lg". |
headerBorder |
Whether to display a border between the header and body. TRUE by default. |
label |
Slot for boxLabel. |
dropdownMenu |
List of items in the boxtool dropdown menu. Use boxDropdown. |
sidebar |
Slot for boxSidebar. |
id |
If passed, the item will behave like an action button. |
subtitle |
User card subtitle. |
image |
User image url or path. |
backgroundImage |
image url, if any. Background needs to be TRUE. |
type |
User card type. Either 1 or 2. 1 corresponds to a centered user image, while 2 is a left aligned user image. |
imageElevation |
User card image elevation (numeric). NULL by default. |
David Granjon, [email protected]
if (interactive()) { library(shiny) library(shinydashboard) library(shinydashboardPlus) shinyApp( ui = dashboardPage( header = dashboardHeader(), sidebar = dashboardSidebar(), controlbar = dashboardControlbar(), footer = dashboardFooter(), title = "test", body = dashboardBody( userBox( title = userDescription( title = "Nadia Carmichael", subtitle = "lead Developer", type = 2, image = "https://adminlte.io/themes/AdminLTE/dist/img/user7-128x128.jpg", ), status = "primary", gradient = TRUE, background = "light-blue", boxToolSize = "xl", "Some text here!", footer = "The footer here!" ), userBox( title = userDescription( title = "Alexander Pierce", subtitle = "Founder & CEO", type = 1, image = "https://adminlte.io/themes/AdminLTE/dist/img/user1-128x128.jpg", ), status = "purple", closable = TRUE, "Some text here!", footer = "The footer here!" ), userBox( title = userDescription( title = "Elizabeth Pierce", subtitle = "Web Designer", image = "https://adminlte.io/themes/AdminLTE/dist/img/user3-128x128.jpg", backgroundImage = "https://cdn.statically.io/img/wallpaperaccess.com/full/1119564.jpg", ), status = "teal", closable = TRUE, maximizable = TRUE, "Some text here!", footer = "The footer here!" ) ) ), server = function(input, output) {} ) }
if (interactive()) { library(shiny) library(shinydashboard) library(shinydashboardPlus) shinyApp( ui = dashboardPage( header = dashboardHeader(), sidebar = dashboardSidebar(), controlbar = dashboardControlbar(), footer = dashboardFooter(), title = "test", body = dashboardBody( userBox( title = userDescription( title = "Nadia Carmichael", subtitle = "lead Developer", type = 2, image = "https://adminlte.io/themes/AdminLTE/dist/img/user7-128x128.jpg", ), status = "primary", gradient = TRUE, background = "light-blue", boxToolSize = "xl", "Some text here!", footer = "The footer here!" ), userBox( title = userDescription( title = "Alexander Pierce", subtitle = "Founder & CEO", type = 1, image = "https://adminlte.io/themes/AdminLTE/dist/img/user1-128x128.jpg", ), status = "purple", closable = TRUE, "Some text here!", footer = "The footer here!" ), userBox( title = userDescription( title = "Elizabeth Pierce", subtitle = "Web Designer", image = "https://adminlte.io/themes/AdminLTE/dist/img/user3-128x128.jpg", backgroundImage = "https://cdn.statically.io/img/wallpaperaccess.com/full/1119564.jpg", ), status = "teal", closable = TRUE, maximizable = TRUE, "Some text here!", footer = "The footer here!" ) ) ), server = function(input, output) {} ) }
userList creates a user list container to be inserted in a box.
userListItem creates a user list item.
userList(...) userListItem(image, title, subtitle = NULL)
userList(...) userListItem(image, title, subtitle = NULL)
... |
slot for userListItem. |
image |
image url or path. |
title |
Item title. |
subtitle |
Item subtitle. |
David Granjon, [email protected]
if (interactive()) { library(shiny) library(shinydashboard) library(shinydashboardPlus) shinyApp( ui = dashboardPage( dashboardHeader(), dashboardSidebar(), dashboardBody( box( title = "User List example", status = "success", userList( userListItem( image = "https://adminlte.io/themes/AdminLTE/dist/img/user1-128x128.jpg", title = "Shiny", subtitle = "Package 1" ), userListItem( image = "https://adminlte.io/themes/AdminLTE/dist/img/user7-128x128.jpg", title = "Tidyverse", subtitle = "Package 2" ), userListItem( image = "https://adminlte.io/themes/AdminLTE/dist/img/user5-128x128.jpg", title = "tidyr", subtitle = "Package 3" ) ) ) ), title = "User List" ), server = function(input, output) { } ) }
if (interactive()) { library(shiny) library(shinydashboard) library(shinydashboardPlus) shinyApp( ui = dashboardPage( dashboardHeader(), dashboardSidebar(), dashboardBody( box( title = "User List example", status = "success", userList( userListItem( image = "https://adminlte.io/themes/AdminLTE/dist/img/user1-128x128.jpg", title = "Shiny", subtitle = "Package 1" ), userListItem( image = "https://adminlte.io/themes/AdminLTE/dist/img/user7-128x128.jpg", title = "Tidyverse", subtitle = "Package 2" ), userListItem( image = "https://adminlte.io/themes/AdminLTE/dist/img/user5-128x128.jpg", title = "tidyr", subtitle = "Package 3" ) ) ) ), title = "User List" ), server = function(input, output) { } ) }
userMessages creates a user message container. Maybe inserted in a box.
userMessage creates a user message html element.
updateUserMessages allows to interact with a userMessages container, such as sending, removing or editing messages.
userMessages(..., id = NULL, status, width = 4, height = NULL) userMessage( ..., author, date = NULL, image = NULL, type = c("sent", "received") ) updateUserMessages( id, action = c("add", "remove", "update"), index = NULL, content = NULL, session = shiny::getDefaultReactiveDomain() )
userMessages(..., id = NULL, status, width = 4, height = NULL) userMessage( ..., author, date = NULL, image = NULL, type = c("sent", "received") ) updateUserMessages( id, action = c("add", "remove", "update"), index = NULL, content = NULL, session = shiny::getDefaultReactiveDomain() )
... |
Message text. |
id |
userMessages to target. |
status |
Messages status. See here for a list of valid colors https://adminlte.io/themes/AdminLTE/pages/UI/general.html. Valid statuses are defined as follows:
|
width |
Container width: between 1 and 12. |
height |
Container height. |
author |
Message author. |
date |
Message date. |
image |
Message author image path or url. |
type |
Message type: |
action |
Action to perform: add, remove or update. |
index |
Index of item to update or remove. |
content |
New message content in a list. For actions like add and update only! See example. |
session |
Shiny session object. |
David Granjon, [email protected]
if (interactive()) { library(shiny) library(shinydashboard) library(shinydashboardPlus) shinyApp( ui = dashboardPage( dashboardHeader(), dashboardSidebar(), dashboardBody( box( title = "Box with messages", solidHeader = TRUE, status = "warning", userMessages( width = 12, status = "success", userMessage( author = "Alexander Pierce", date = "20 Jan 2:00 pm", image = "https://adminlte.io/themes/AdminLTE/dist/img/user1-128x128.jpg", type = "sent", "Is this template really for free? That's unbelievable!" ), userMessage( author = "Sarah Bullock", date = "23 Jan 2:05 pm", image = "https://adminlte.io/themes/AdminLTE/dist/img/user3-128x128.jpg", type = "received", "You better believe it!" ) ) ), userMessages( width = 6, status = "danger", userMessage( author = "Alexander Pierce", date = "20 Jan 2:00 pm", image = "https://adminlte.io/themes/AdminLTE/dist/img/user1-128x128.jpg", type = "received", "Is this template really for free? That's unbelievable!" ), userMessage( author = "Sarah Bullock", date = "23 Jan 2:05 pm", image = "https://adminlte.io/themes/AdminLTE/dist/img/user3-128x128.jpg", type = "sent", "You better believe it!" ) ) ), title = "user Message" ), server = function(input, output) { } ) } if (interactive()) { library(shiny) library(shinydashboard) library(shinydashboardPlus) shinyApp( ui = dashboardPage( dashboardHeader(), dashboardSidebar(), dashboardBody( fluidRow( actionButton("remove", "Remove message"), actionButton("add", "Add message"), actionButton("update", "Update message") ), numericInput("index", "Message index:", 1, min = 1, max = 3), br(), br(), userMessages( width = 6, status = "danger", id = "message", userMessage( author = "Alexander Pierce", date = "20 Jan 2:00 pm", image = "https://adminlte.io/themes/AdminLTE/dist/img/user1-128x128.jpg", type = "received", "Is this template really for free? That's unbelievable!" ), userMessage( author = "Sarah Bullock", date = "23 Jan 2:05 pm", image = "https://adminlte.io/themes/AdminLTE/dist/img/user3-128x128.jpg", type = "sent", "You better believe it!" ) ) ), title = "user Message" ), server = function(input, output, session) { observeEvent(input$remove, { updateUserMessages("message", action = "remove", index = input$index) }) observeEvent(input$add, { updateUserMessages( "message", action = "add", content = list( author = "David", date = "Now", image = "https://i.pinimg.com/originals/f1/15/df/f115dfc9cab063597b1221d015996b39.jpg", type = "received", text = tagList( sliderInput( "obs", "Number of observations:", min = 0, max = 1000, value = 500 ), plotOutput("distPlot") ) ) ) }) output$distPlot <- renderPlot({ hist(rnorm(input$obs)) }) observeEvent(input$update, { updateUserMessages( "message", action = "update", index = input$index, content = list( text = tagList( appButton( inputId = "reload", label = "Click me!", icon = icon("arrows-rotate"), dashboardBadge(1, color = "orange") ) ) ) ) }) observeEvent(input$reload, { showNotification("Yeah!", duration = 1, type = "default") }) } ) }
if (interactive()) { library(shiny) library(shinydashboard) library(shinydashboardPlus) shinyApp( ui = dashboardPage( dashboardHeader(), dashboardSidebar(), dashboardBody( box( title = "Box with messages", solidHeader = TRUE, status = "warning", userMessages( width = 12, status = "success", userMessage( author = "Alexander Pierce", date = "20 Jan 2:00 pm", image = "https://adminlte.io/themes/AdminLTE/dist/img/user1-128x128.jpg", type = "sent", "Is this template really for free? That's unbelievable!" ), userMessage( author = "Sarah Bullock", date = "23 Jan 2:05 pm", image = "https://adminlte.io/themes/AdminLTE/dist/img/user3-128x128.jpg", type = "received", "You better believe it!" ) ) ), userMessages( width = 6, status = "danger", userMessage( author = "Alexander Pierce", date = "20 Jan 2:00 pm", image = "https://adminlte.io/themes/AdminLTE/dist/img/user1-128x128.jpg", type = "received", "Is this template really for free? That's unbelievable!" ), userMessage( author = "Sarah Bullock", date = "23 Jan 2:05 pm", image = "https://adminlte.io/themes/AdminLTE/dist/img/user3-128x128.jpg", type = "sent", "You better believe it!" ) ) ), title = "user Message" ), server = function(input, output) { } ) } if (interactive()) { library(shiny) library(shinydashboard) library(shinydashboardPlus) shinyApp( ui = dashboardPage( dashboardHeader(), dashboardSidebar(), dashboardBody( fluidRow( actionButton("remove", "Remove message"), actionButton("add", "Add message"), actionButton("update", "Update message") ), numericInput("index", "Message index:", 1, min = 1, max = 3), br(), br(), userMessages( width = 6, status = "danger", id = "message", userMessage( author = "Alexander Pierce", date = "20 Jan 2:00 pm", image = "https://adminlte.io/themes/AdminLTE/dist/img/user1-128x128.jpg", type = "received", "Is this template really for free? That's unbelievable!" ), userMessage( author = "Sarah Bullock", date = "23 Jan 2:05 pm", image = "https://adminlte.io/themes/AdminLTE/dist/img/user3-128x128.jpg", type = "sent", "You better believe it!" ) ) ), title = "user Message" ), server = function(input, output, session) { observeEvent(input$remove, { updateUserMessages("message", action = "remove", index = input$index) }) observeEvent(input$add, { updateUserMessages( "message", action = "add", content = list( author = "David", date = "Now", image = "https://i.pinimg.com/originals/f1/15/df/f115dfc9cab063597b1221d015996b39.jpg", type = "received", text = tagList( sliderInput( "obs", "Number of observations:", min = 0, max = 1000, value = 500 ), plotOutput("distPlot") ) ) ) }) output$distPlot <- renderPlot({ hist(rnorm(input$obs)) }) observeEvent(input$update, { updateUserMessages( "message", action = "update", index = input$index, content = list( text = tagList( appButton( inputId = "reload", label = "Click me!", icon = icon("arrows-rotate"), dashboardBadge(1, color = "orange") ) ) ) ) }) observeEvent(input$reload, { showNotification("Yeah!", duration = 1, type = "default") }) } ) }
This can be used as a placeholder for dynamically-generated dashboardUser
.
userOutput(id, tag = shiny::tags$li)
userOutput(id, tag = shiny::tags$li)
id |
Output variable name. |
tag |
A tag function, like |
renderUser
for the corresponding server side function
and examples.
Other user outputs:
renderUser()
userPost creates a user post. This content may be inserted in a box.
userPostTagItems creates a container to host userPostTagItem.
userPostTagItem creates a user post tool item
userPostMedia creates a container to include an image in userPost.
userPost( ..., id = NULL, image, author, description = NULL, collapsible = TRUE, collapsed = FALSE ) userPostTagItems(...) userPostTagItem(..., side = "left") userPostMedia(image, height = NULL, width = NULL)
userPost( ..., id = NULL, image, author, description = NULL, collapsible = TRUE, collapsed = FALSE ) userPostTagItems(...) userPostTagItem(..., side = "left") userPostMedia(image, height = NULL, width = NULL)
... |
tool content such as label, button, ... |
id |
unique id of the post. |
image |
image path or url ... |
author |
post author. |
description |
post description. |
collapsible |
If TRUE, display a button in the upper right that allows the user to collapse the comment. |
collapsed |
Whether the comment is collapsed when the application starts, FALSE by default. |
side |
tool item orientation: "left" of "right", "left" by default. |
height |
media height in pixels. |
width |
media width in pixels. |
David Granjon, [email protected]
if (interactive()) { library(shiny) library(shinydashboard) library(shinydashboardPlus) shinyApp( ui = dashboardPage( dashboardHeader(), dashboardSidebar(), dashboardBody( box( title = "Box with user comment", status = "primary", userPost( id = 1, image = "https://adminlte.io/themes/AdminLTE/dist/img/user1-128x128.jpg", author = "Jonathan Burke Jr.", description = "Shared publicly - 7:30 PM today", "Lorem ipsum represents a long-held tradition for designers, typographers and the like. Some people hate it and argue for its demise, but others ignore the hate as they create awesome tools to help create filler text for everyone from bacon lovers to Charlie Sheen fans.", collapsible = FALSE, userPostTagItems( userPostTagItem(dashboardLabel("item 1", status = "info")), userPostTagItem(dashboardLabel("item 2", status = "danger"), side = "right") ) ), userPost( id = 2, image = "https://adminlte.io/themes/AdminLTE/dist/img/user6-128x128.jpg", author = "Adam Jones", userPostMedia(image = "https://adminlte.io/themes/AdminLTE/dist/img/photo2.png"), userPostTagItems( userPostTagItem(dashboardLabel("item 1", status = "success")), userPostTagItem(dashboardLabel("item 2", status = "danger"), side = "right") ) ) ) ), title = "userPost" ), server = function(input, output) { } ) }
if (interactive()) { library(shiny) library(shinydashboard) library(shinydashboardPlus) shinyApp( ui = dashboardPage( dashboardHeader(), dashboardSidebar(), dashboardBody( box( title = "Box with user comment", status = "primary", userPost( id = 1, image = "https://adminlte.io/themes/AdminLTE/dist/img/user1-128x128.jpg", author = "Jonathan Burke Jr.", description = "Shared publicly - 7:30 PM today", "Lorem ipsum represents a long-held tradition for designers, typographers and the like. Some people hate it and argue for its demise, but others ignore the hate as they create awesome tools to help create filler text for everyone from bacon lovers to Charlie Sheen fans.", collapsible = FALSE, userPostTagItems( userPostTagItem(dashboardLabel("item 1", status = "info")), userPostTagItem(dashboardLabel("item 2", status = "danger"), side = "right") ) ), userPost( id = 2, image = "https://adminlte.io/themes/AdminLTE/dist/img/user6-128x128.jpg", author = "Adam Jones", userPostMedia(image = "https://adminlte.io/themes/AdminLTE/dist/img/photo2.png"), userPostTagItems( userPostTagItem(dashboardLabel("item 1", status = "success")), userPostTagItem(dashboardLabel("item 2", status = "danger"), side = "right") ) ) ) ), title = "userPost" ), server = function(input, output) { } ) }
AdminLTE2 social box
Description
socialBox creates a special box dedicated for social content.
userBlock goes in the title of socialBox.
boxComment has to be inserted in the comment slot of socialBox.
Usage
Arguments
...
comment content.
title
comment title.
footer
Optional footer text.
width
The width of the box, using the Bootstrap grid system. This is used for row-based layouts. The overall width of a region is 12, so the default valueBox width of 4 occupies 1/3 of that width. For column-based layouts, use
NULL
for the width; the width is set by the column that contains the box.height
The height of a box, in pixels or other CSS unit. By default the height scales automatically with the content.
collapsible
If TRUE, display a button in the upper right that allows the user to collapse the box.
collapsed
If TRUE, start collapsed. This must be used with
collapsible=TRUE
.closable
If TRUE, display a button in the upper right that allows the user to close the box.
boxToolSize
Size of the toolbox: choose among "xs", "sm", "md", "lg".
headerBorder
Whether to display a border between the header and body. TRUE by default.
label
Slot for boxLabel.
dropdownMenu
List of items in the boxtool dropdown menu. Use boxDropdown.
sidebar
Slot for boxSidebar.
id
If passed, the item will behave like an action button.
image
author image, if any.
subtitle
Any subtitle.
href
Target url or page.
date
date of publication.
Author(s)
David Granjon, [email protected]
Examples