Skip to contents

Create a header of a dashboard with other additional UI elements. Hint: use shiny::tagList() if you want to add multiple elements in left / center or right.

Usage

dashboard_header(
  ...,
  left = NULL,
  center = NULL,
  right = NULL,
  title = NULL,
  titleWidth = "thin",
  logo_align = "center",
  logo_path = "",
  color = "",
  inverted = FALSE,
  disable = FALSE,
  show_menu_button = TRUE,
  menu_button_label = "Menu",
  class = ""
)

dashboardHeader(
  ...,
  left = NULL,
  center = NULL,
  right = NULL,
  title = NULL,
  titleWidth = "thin",
  logo_align = "center",
  logo_path = "",
  color = "",
  inverted = FALSE,
  disable = FALSE,
  show_menu_button = TRUE,
  menu_button_label = "Menu",
  class = ""
)

Arguments

...

UI elements to include within the header. They will be displayed on the right side.

left

UI element to put on the left of the header. It will be placed after (to the right) the title and menu button (if they exist).

center

UI element to put in the center of the header.

right

UI element to put to the right of the header. It will be placed before elements defined in ... (if there are any).

title

Dashboard title to be displayed in the upper left corner. If NULL, will not display any title field. Use "" for an empty title.

titleWidth

Title field width, one of c(NULL, "very thin", "thin", "wide", "very wide")

logo_align

Where should logo be placed. One of c("left", "center")

logo_path

Path or URL of the logo to be shown in the header.

color

Color of the sidebar / text / icons (depending on the value of `inverted` parameter. One of c("", "red", "orange", "yellow", "olive", "green", "teal", "blue", "violet", "purple", "pink", "brown", "grey", "black")

inverted

If FALSE sidebar will be white and text will be colored. \ If TRUE text will be white and background will be colored. Default is FALSE.

disable

If TRUE, don't display the header.

show_menu_button

If FALSE, don't display the menu button. Default is TRUE.

menu_button_label

Text of the menu button. Default is "Menu".

class

CSS class to be applied to the container of dashboardHeader.

Value

A header that can be passed to dashboardPage

Functions

  • dashboardHeader(): Create a header of a dashboard (alias for dashboard_header for compatibility with shinydashboard)

Examples

if(interactive()) {

  library(shiny)
  library(semantic.dashboard)

  ui <- dashboardPage(
    dashboardHeader(color = "blue", inverted = TRUE),
    dashboardSidebar(side = "left", size = "thin", color = "teal",
                     sidebarMenu(
                       menuItem(tabName = "tab1", "Tab 1"),
                       menuItem(tabName = "tab2", "Tab 2"))),
    dashboardBody(tabItems(
      tabItem(tabName = "tab1", p("Tab 1")),
      tabItem(tabName = "tab2", p("Tab 2"))))
  )

  server <- function(input, output) {
  }

  shinyApp(ui, server)
}