A guided tour of the UI components in bslibdash. New here? Start with
vignette("getting-started") for an end-to-end app; for
restyling see vignette("theming").
All examples assume:
box() is the primary card. boxLayout()
arranges several cards in a responsive grid, and
updateBox() controls a card from the server.
boxLayout(
box("First card", title = "Status", status = "primary"),
box("Second card", title = "Details", status = "info",
collapsible = TRUE),
type = "deck"
)
# server side
updateBox("status", action = "toggle") # collapse/expand
updateBox("status", action = "update",
options = list(title = "Updated", status = "success"))Valid status/background values are the
eight Bootstrap status names (primary,
secondary, success, info,
warning, danger, light,
dark).
fluidRow(
valueBox("128", "Open tickets", icon = icon("inbox"), color = "primary"),
valueBox("42%", "CPU", icon = icon("cpu"), color = "warning"),
infoBox(title = "Status", value = "Healthy", color = "success")
)Both accept Bootstrap status names (primary,
success, …) and the legacy
shinydashboard palette (aqua,
green, red, …), which is mapped
automatically.
Most dynamic bslibdash components follow the familiar Shiny
*Output() + render*() pattern. Place the
*Output() in the UI where the component should appear, then
build it from the server with the matching render*():
| UI side | Server side | Re-renders |
|---|---|---|
valueBoxOutput() |
renderValueBox() |
A single valueBox() |
infoBoxOutput() |
renderInfoBox() |
A single infoBox() |
dropdownMenuOutput() |
renderDropdownMenu() |
A header dropdownMenu() |
sidebarMenuOutput() |
renderMenu() |
A sidebarMenu() |