diff --git a/R/boxes.R b/R/boxes.R index 4f287ec9..0e78a22e 100644 --- a/R/boxes.R +++ b/R/boxes.R @@ -119,6 +119,7 @@ infoBox <- function(title, value = NULL, subtitle = NULL, #' the user to collapse the box. #' @param collapsed If TRUE, start collapsed. This must be used with #' \code{collapsible=TRUE}. +#' @param id ID of the outmost div object for a better handling in the CSS file. #' @param ... Contents of the box. #' #' @family boxes @@ -250,7 +251,8 @@ infoBox <- function(title, value = NULL, subtitle = NULL, #' @export box <- function(..., title = NULL, footer = NULL, status = NULL, solidHeader = FALSE, background = NULL, width = 6, - height = NULL, collapsible = FALSE, collapsed = FALSE) { + height = NULL, collapsible = FALSE, collapsed = FALSE, + id = NULL) { boxClass <- "box" if (solidHeader || !is.null(background)) { @@ -301,6 +303,7 @@ box <- function(..., title = NULL, footer = NULL, status = NULL, } div(class = if (!is.null(width)) paste0("col-sm-", width), + id = ifelse( !is.null(id), id, paste0("col-sm-", width)), div(class = boxClass, style = if (!is.null(style)) style, headerTag, @@ -401,6 +404,7 @@ tabBox <- function(..., id = NULL, selected = NULL, title = NULL, tags$li(class = paste("header", titleClass), title) ) } - - div(class = paste0("col-sm-", width), content) + if ( is.null( id ) ) + id <- "" + div(class = paste0("col-sm-", width), content, id = id) } diff --git a/README.md b/README.md index 1ffcf59d..2be55759 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,7 @@ +# Why I did this fork? + +Since I wanted the ID of a box to be set in the outmost div object and not somewhere in the third layer. Else I wouldn't be able to customize their behavior using CSS3. + Shiny Dashboard =============== diff --git a/man/box.Rd b/man/box.Rd index 9626aaf0..364fae5e 100644 --- a/man/box.Rd +++ b/man/box.Rd @@ -6,7 +6,7 @@ \usage{ box(..., title = NULL, footer = NULL, status = NULL, solidHeader = FALSE, background = NULL, width = 6, height = NULL, - collapsible = FALSE, collapsed = FALSE) + collapsible = FALSE, collapsed = FALSE, id = NULL) } \arguments{ \item{...}{Contents of the box.} @@ -38,6 +38,8 @@ the user to collapse the box.} \item{collapsed}{If TRUE, start collapsed. This must be used with \code{collapsible=TRUE}.} + +\item{id}{ID of the outmost div object for a better handling in the CSS file.} } \description{ Boxes can be used to hold content in the main body of a dashboard.