Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions R/boxes.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)) {
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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)
}
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -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
===============

Expand Down
4 changes: 3 additions & 1 deletion man/box.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.