Search code examples
rshinyshinydashboardshinydashboardplus

Shinydahsboardplus: how to add box without a title?


after recent update of ShinydasboardPlus (to 2.0) I can't manage to make box with no header and and no space for header.

I tried title = NULL, headerBorder = FALSE and still have this space. How to get rid of that? I want a box ONLY with content, no header, no space for header. enter image description here

Thanks!

Example:

library(shiny)
library(shinydashboard)
library(shinydashboardPlus)
ui <- dashboardPage(
  title = "Box API",
  dashboardHeader(),
  dashboardSidebar(),
  dashboardBody(
    box(
      title = NULL,
      headerBorder = FALSE,
      "Box body")
  )
)

server <- function(input, output, session) {
}

shinyApp(ui, server)

Solution

  • You can use css to not display the header. Something like this:

    ui <- dashboardPage(
      title = "Box API",
      dashboardHeader(),
      dashboardSidebar(),
      dashboardBody(
        box(
          id = 'foo',  # use an id to only select this box
          title = NULL,
          headerBorder = FALSE,
          "Box body"
        ),
        tags$head(tags$style('#foo .box-header{ display: none}'))  # target the box header of foo
      )
    )