bs4Dash (version 0.5.0)

bs4Card: Create a Boostrap 4 card

Description

Build an adminLTE3 card

Usage

bs4Card(
  ...,
  inputId = NULL,
  title = NULL,
  footer = NULL,
  status = NULL,
  elevation = NULL,
  solidHeader = FALSE,
  headerBorder = TRUE,
  gradientColor = NULL,
  width = 6,
  height = NULL,
  collapsible = TRUE,
  collapsed = FALSE,
  closable = TRUE,
  maximizable = FALSE,
  labelStatus = NULL,
  labelText = NULL,
  labelTooltip = NULL,
  dropdownMenu = NULL,
  dropdownIcon = "wrench",
  overflow = FALSE,
  enable_sidebar = FALSE,
  sidebar_content = NULL,
  sidebar_width = "25%",
  sidebar_background = "#333a40",
  sidebar_start_open = FALSE,
  sidebar_icon = "cogs"
)

box( ..., inputId = NULL, title = NULL, footer = NULL, status = NULL, elevation = NULL, solidHeader = FALSE, headerBorder = TRUE, gradientColor = NULL, width = 6, height = NULL, collapsible = TRUE, collapsed = FALSE, closable = TRUE, maximizable = FALSE, labelStatus = NULL, labelText = NULL, labelTooltip = NULL, dropdownMenu = NULL, dropdownIcon = "wrench", overflow = FALSE, enable_sidebar = FALSE, sidebar_content = NULL, sidebar_width = "25%", sidebar_background = "#333a40", sidebar_start_open = FALSE, sidebar_icon = "cogs" )

Arguments

...

Contents of the box.

inputId

Get the state of the card. Optional.

title

Optional title.

footer

Optional footer text.

status

The status of the card header. "primary", "secondary", "success", "warning", "danger", "white", "light", "dark", "transparent". NULL by default.

elevation

Card elevation.

solidHeader

Should the header be shown with a solid color background?

headerBorder

Whether to display a border between the header and body. TRUE by default

gradientColor

If NULL (the default), the background of the box will be white. Otherwise, a color string. "primary", "success", "warning" or "danger".

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 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.

maximizable

If TRUE, the card can be displayed in full screen mode.

labelStatus

status of the box label: "primary", "secondary", "success", "warning", "danger", "white", "light", "dark", "transparent".

labelText

Label text.

labelTooltip

Label tooltip displayed on hover.

dropdownMenu

List of items in the the boxtool dropdown menu. Use dropdownItemList.

dropdownIcon

Dropdown icon. "wrench" by default.

overflow

Whether to enable overflow in the card body and footer. FALSE by default.

enable_sidebar

Whether to display the box sidebar. FALSE by default.

sidebar_content

Box sidebar content, if any.

sidebar_width

Box sidebar width in percentage. 25% by default. A character value of any width CSS understands (e.g. "100px")

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.

See Also

Other cards: bs4InfoBox(), bs4TabCard(), bs4ValueBox()

Examples

Run this code
# NOT RUN {
if(interactive()){
 library(shiny)
 library(bs4Dash)

 shiny::shinyApp(
   ui = bs4DashPage(
    navbar = bs4DashNavbar(),
    sidebar = bs4DashSidebar(),
    controlbar = bs4DashControlbar(),
    footer = bs4DashFooter(),
    title = "test",
    body = bs4DashBody(
    fluidRow(
     column(
      width = 6,
      bs4Card(
       title = "Closable Box with dropdown", 
       closable = TRUE, 
       width = 12,
       status = "warning", 
       solidHeader = FALSE, 
       collapsible = TRUE,
       labelText = 1,
       labelStatus = "danger",
       labelTooltip = "Hi Bro!",
       dropdownIcon = "wrench",
       dropdownMenu = dropdownItemList(
         dropdownItem(url = "http://www.google.com", name = "Link to google"),
         dropdownItem(url = "#", name = "item 2"),
         dropdownDivider(),
         dropdownItem(url = "#", name = "item 3")
       ),
       p("Box Content")
      )
     ),
     column(
      width = 6, 
      bs4Card(
       title = "Closable Box with gradient", 
       closable = TRUE, 
       width = 12,
       status = "warning", 
       solidHeader = FALSE, 
       gradientColor = "success",
       collapsible = TRUE,
       p("Box Content")
      )
     )
     ),
     fluidRow(
      bs4Card(
       title = "Closable Box with solidHeader", 
       closable = TRUE, 
       width = 6,
       solidHeader = TRUE, 
       status = "primary",
       collapsible = TRUE,
       p("Box Content")
      ),
      bs4Card(
       title = "Maximizable Card", 
       width = 6,
       status = "warning", 
       closable = FALSE,
       maximizable = TRUE, 
       collapsible = FALSE,
       sliderInput("obs", "Number of observations:",
                   min = 0, max = 1000, value = 500
       ),
       plotOutput("distPlot")
      )
     )
    )
   ),
   server = function(input, output) {
    output$distPlot <- renderPlot({
     hist(rnorm(input$obs))
    })
   }
 )
}

# }

Run the code above in your browser using DataLab