Skip to contents

Build an Bootstrap 4 table container

Build an bs4 table item row

Build an bs4 table item

Usage

bs4Table(data, cardWrap = FALSE, bordered = FALSE, striped = FALSE, width = 12)

bs4TableItems(...)

bs4TableItem(..., dataCell = FALSE)

Arguments

data

Expect dataframe, tibble or list of shiny tags... See examples.

cardWrap

Whether to wrap the table in a card. FALSE by default.

bordered

Whether to display border between elements. FALSE by default.

striped

Whether to displayed striped in elements. FALSE by default.

width

Table width. 12 by default.

...

Any HTML element.

dataCell

Whether the cell should be contain data or text. <td> by default.

Author

David Granjon, dgranjon@ymail.com

Examples

if (interactive()) {
 library(shiny)
 library(bs4Dash)
 
 # width dataframe as input
 shinyApp(
  ui = dashboardPage(
    header = dashboardHeader(), 
    sidebar = dashboardSidebar(),
    body = dashboardBody(
     bs4Table(
      cardWrap = TRUE,
      bordered = TRUE,
      striped = TRUE,
      iris
     )
    ), 
    footer = dashboardFooter()
  ),
  server = function(input, output) { }
 )
 
 # with shiny tags as input
 shinyApp(
  ui = dashboardPage(
    header = dashboardHeader(), 
    sidebar = dashboardSidebar(),
    body = dashboardBody(
      bs4Table(
        cardWrap = TRUE,
        bordered = TRUE,
        striped = TRUE,
        list(
          list(
            income = "$2,500 USD", 
            status = dashboardBadge(
              "Pending",
              position = "right",
              color = "danger",
              rounded = TRUE
            ), 
            progress = progressBar(value = 50, status = "pink", size = "xxs"), 
            text = "test", 
            confirm = actionButton(
              "go",
              "Go"
            )
          ),
          list("$2,500 USD", "NA", "NA", "test", "NA")
        )
      )
    ), 
    footer = dashboardFooter()
  ),
  server = function(input, output) {}
 )
}