Getting rid of the renderUI

  1. Customize the previously designed box() function to gather as many parameters as possible.

    • width should be numeric
    • title might be any HTML tag or a list of HTML tags
  2. Omit any NULL parameter from the props list.

box2 <- function(..., id = NULL, title = NULL, footer = NULL,
                 background = NULL, width = 6, height = NULL,
                 collapsible = FALSE, collapsed = FALSE) {
  
  if (!is.null(title)) {
    processed_title <- if (
      inherits(title, "shiny.tag.list") ||
      inherits(title, "shiny.tag")
    ) {
      as.character(title)
    } else {
      title
    }
  }
  
  # We don’t want to send empty arrays
  props <- dropNulls(
    list(
      title = processed_title,
      background = background,
      width = width
    )
  )
  
  # ....; Extra code removed
}