boxSidebar is inserted in the sidebar slot of box.
updateBoxSidebar toggle a boxSidebar on the client.
boxSidebar(
...,
id = NULL,
width = 50,
background = "#333a40",
startOpen = FALSE,
icon = shiny::icon("cogs")
)
updateBoxSidebar(id, session = shiny::getDefaultReactiveDomain())
Sidebar content.
Sidebar id.
Sidebar opening width in percentage. 50% by default, means the card sidebar will take 50 A numeric value between 25 and 100.
Sidebar background color. Dark by default. Expect a HEX code.
Whether the sidebar is open at start. FALSE by default.
Sidebar icon. Expect icon
.
Shiny session object.
# Toggle a box sidebar
if (interactive()) {
library(shiny)
library(shinydashboard)
library(shinydashboardPlus)
shinyApp(
ui = dashboardPage(
header = dashboardHeader(),
body = dashboardBody(
box(
title = "Update box sidebar",
closable = TRUE,
width = 12,
height = "500px",
solidHeader = FALSE,
collapsible = TRUE,
actionButton("update", "Toggle card sidebar"),
sidebar = boxSidebar(
id = "mycardsidebar",
p("Sidebar Content")
)
)
),
sidebar = dashboardSidebar()
),
server = function(input, output, session) {
observe(print(input$mycardsidebar))
observeEvent(input$update, {
updateBoxSidebar("mycardsidebar")
})
}
)
}