From bbe0f222a76871ab09ce2457ee6c7c14dcc2a3b4 Mon Sep 17 00:00:00 2001 From: stephLH Date: Tue, 28 Apr 2020 21:22:43 +0200 Subject: [PATCH] tabBox: add a footer argument --- R/boxes.R | 11 ++++++++++- man/tabBox.Rd | 4 +++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/R/boxes.R b/R/boxes.R index 4f287ec9..855ba839 100644 --- a/R/boxes.R +++ b/R/boxes.R @@ -318,6 +318,7 @@ box <- function(..., title = NULL, footer = NULL, status = NULL, #' @param side Which side of the box the tabs should be on (\code{"left"} or #' \code{"right"}). When \code{side="right"}, the order of tabs will be #' reversed. +#' @param footer Optional footer text. #' #' @family boxes #' @@ -367,7 +368,7 @@ box <- function(..., title = NULL, footer = NULL, status = NULL, #' ) #' } #' @export -tabBox <- function(..., id = NULL, selected = NULL, title = NULL, +tabBox <- function(..., id = NULL, selected = NULL, title = NULL, footer = NULL, width = 6, height = NULL, side = c("left", "right")) { side <- match.arg(side) @@ -402,5 +403,13 @@ tabBox <- function(..., id = NULL, selected = NULL, title = NULL, ) } + # Add footer + if (!is.null(footer)) { + content <- htmltools::tagAppendChild( + content, + div(class = "box-footer", footer) + ) + } + div(class = paste0("col-sm-", width), content) } diff --git a/man/tabBox.Rd b/man/tabBox.Rd index f6e379a3..8d1e58ac 100644 --- a/man/tabBox.Rd +++ b/man/tabBox.Rd @@ -5,7 +5,7 @@ \title{Create a tabbed box} \usage{ tabBox(..., id = NULL, selected = NULL, title = NULL, width = 6, - height = NULL, side = c("left", "right")) + footer = NULL, height = NULL, side = c("left", "right")) } \arguments{ \item{...}{\code{\link{tabPanel}} elements to include in the tabset} @@ -21,6 +21,8 @@ tab will be selected.} \item{title}{Title for the tabBox.} +\item{footer}{Optional footer text.} + \item{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