Description Usage Arguments Examples
Boxes can be used to hold content in the main body of a dashboard.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | boxPlus(
...,
inputId = NULL,
title = NULL,
footer = NULL,
status = NULL,
solidHeader = FALSE,
background = NULL,
width = 6,
height = NULL,
collapsible = FALSE,
collapsed = FALSE,
closable = TRUE,
enable_label = FALSE,
label_text = NULL,
label_status = "primary",
enable_dropdown = FALSE,
dropdown_icon = "wrench",
dropdown_menu = NULL,
enable_sidebar = FALSE,
sidebar_content = NULL,
sidebar_title = NA_character_,
sidebar_width = 25,
sidebar_background = "#222d32",
sidebar_start_open = FALSE,
sidebar_icon = "cogs",
footer_padding = TRUE
)
|
... |
Contents of the box. |
inputId |
Box unique id. updateBoxPlus target. |
title |
Optional title. |
footer |
Optional footer text. |
status |
The status of the item This determines the item's background color. Valid statuses are listed in validStatuses. |
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. |
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. |
enable_label |
Whether to display a label in the boxtool. |
label_text |
label text. |
label_status |
status of the box label: "danger", "success", "info", "primary", "warning". |
enable_dropdown |
Whether to display a dropdown menu in the boxtool. FALSE by default. |
dropdown_icon |
Dropdown icon. "wrench" by default. |
dropdown_menu |
List of items in the the boxtool dropdown menu. Use dropdownItemList(). |
enable_sidebar |
Whether to display the box sidebar. FALSE by default. |
sidebar_content |
Box sidebar content, if any. |
sidebar_title |
Box sidebar title. |
sidebar_width |
Box sidebar width in percentage. 25% by default. Numeric value between 0 and 100. |
sidebar_background |
Box sidebar background color. Dark by default. |
sidebar_start_open |
Whether the box sidebar is open at start. FALSE by default. |
sidebar_icon |
Box sidebar icon. |
footer_padding |
TRUE by default: whether the footer has margin or not. |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 | ## Only run this example in interactive R sessions
if (interactive()) {
library(shiny)
library(shinydashboard)
shinyApp(
ui = dashboardPagePlus(
dashboardHeaderPlus(),
dashboardSidebar(),
dashboardBody(
fluidRow(
boxPlus(
title = "Closable Box with dropdown",
closable = TRUE,
status = "warning",
solidHeader = FALSE,
collapsible = TRUE,
enable_dropdown = TRUE,
dropdown_icon = "wrench",
dropdown_menu = dropdownItemList(
dropdownItem(url = "https://www.google.com", name = "Link to google"),
dropdownItem(url = "#", name = "item 2"),
dropdownDivider(),
dropdownItem(url = "#", name = "item 3")
),
p("Box Content")
),
boxPlus(
title = "Closable box, with label",
closable = TRUE,
enable_label = TRUE,
label_text = 1,
label_status = "danger",
status = "warning",
solidHeader = FALSE,
collapsible = TRUE,
p("Box Content")
)
)
)
),
server = function(input, output) {}
)
# boxPlus with sidebar
shinyApp(
ui = dashboardPagePlus(
dashboardHeaderPlus(),
dashboardSidebar(),
dashboardBody(
fluidRow(
boxPlus(
title = "Closable Box with dropdown",
closable = TRUE,
status = "warning",
solidHeader = FALSE,
collapsible = TRUE,
enable_sidebar = TRUE,
sidebar_width = 25,
side_bar_title = "Title",
sidebar_start_open = TRUE,
sidebar_content = sliderInput(
"obs",
"Number of observations:",
min = 0,
max = 1000,
value = 500
),
plotOutput("distPlot")
)
)
)
),
server = function(input, output) {
output$distPlot <- renderPlot({
hist(rnorm(input$obs))
})
}
)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.