dashboardControlbar: Create a Boostrap 4 dashboard right sidebar

bs4DashControlbarR Documentation

Create a Boostrap 4 dashboard right sidebar

Description

Build an adminLTE3 dashboard right sidebar

Usage

bs4DashControlbar(
  ...,
  id = NULL,
  disable = FALSE,
  width = 250,
  collapsed = TRUE,
  overlay = TRUE,
  skin = NULL,
  pinned = NULL
)

controlbarMenu(
  ...,
  id = NULL,
  selected = NULL,
  type = c("tabs", "pills", "hidden"),
  vertical = FALSE,
  side = "left",
  .list = NULL
)

controlbarItem(title, ..., value = title, icon = NULL)

updateControlbarMenu(
  session = shiny::getDefaultReactiveDomain(),
  inputId,
  selected = NULL
)

updateControlbar(id, session = shiny::getDefaultReactiveDomain())

dashboardControlbar(
  ...,
  id = NULL,
  disable = FALSE,
  width = 250,
  collapsed = TRUE,
  overlay = TRUE,
  skin = NULL,
  pinned = NULL
)

Arguments

...

Any UI element.

id

Controlbar id.

disable

If TRUE, the sidebar will be disabled.

width

Controlbar width. This must either be a number which specifies the width in pixels, or a string that specifies the width in CSS units. 250 px by default.

collapsed

Whether the control bar on the right side is collapsed or not at start. TRUE by default.

overlay

Whether the sidebar covers the content when expanded. Default to TRUE.

skin

Controlbar skin. "dark" or "light". Matches the dashboardPage dark parameter value.

pinned

Whether to block the controlbar state (TRUE or FALSE). Default to NULL.

selected

The value (or, if none was supplied, the title) of the tab that should be selected by default. If NULL, the first tab will be selected.

type
'"tabs"'

Standard tab look

'"pills"'

Selected tabs use the background fill color

vertical

Whether to displays tabs vertically. Default to FALSE.

side

Tabs side: "left" or "right".

.list

In case of programmatically generated items. See example.

title

Display title for tab

value

The value that should be sent when tabsetPanel reports that this tab is selected. If omitted and tabsetPanel has an id, then the title will be used.

icon

Optional icon to appear on the tab. This attribute is only valid when using a tabPanel within a navbarPage().

session

Shiny session object.

inputId

The id of the tabsetPanel, navlistPanel, or navbarPage object.

Author(s)

David Granjon, dgranjon@ymail.com

Examples

if (interactive()) {
  library(shiny)
  library(bs4Dash)

  shinyApp(
    ui = dashboardPage(
      header = dashboardHeader(),
      sidebar = dashboardSidebar(),
      body = dashboardBody(
        actionButton(inputId = "controlbarToggle", label = "Toggle Controlbar")
      ),
      controlbar = dashboardControlbar(
        id = "controlbar",
        collapsed = FALSE,
        overlay = TRUE
      ),
      title = "updateControlbar"
    ),
    server = function(input, output, session) {
      observeEvent(input$controlbar, {
        if (input$controlbar) {
          showModal(modalDialog(
            title = "Alert",
            "The controlbar is opened.",
            easyClose = TRUE,
            footer = NULL
          ))
        }
      })

      observeEvent(input$controlbarToggle, {
        updateControlbar(id = "controlbar", session = session)
      })

      observe({
        print(input$controlbar)
      })
    }
  )
}

bs4Dash documentation built on Sept. 11, 2024, 8:46 p.m.