bs4Dashkit reads a small set of options()
so you can establish project-wide defaults without repeating the same
arguments in every app.
Options are only used when the corresponding argument is not provided
(or is NULL).
| Option | Used by | Purpose | Default |
|---|---|---|---|
bs4Dashkit.sidebar.collapsed |
dash_titles() |
Sidebar brand mode when collapsed | "icon-only" |
bs4Dashkit.sidebar.expanded |
dash_titles() |
Sidebar brand mode when expanded | "icon-only" |
bs4Dashkit.brand_divider |
dash_titles() |
Show divider under brand strip | TRUE |
bs4Dashkit.theme_preset |
use_bs4Dashkit_core() |
Default preset name when preset = NULL |
NULL |
bs4Dashkit.accent |
use_bs4Dash_core() |
Default accent when accent = NULL |
"#2f6f8f" |
bs4Dashkit.debug |
dash_titles |
Enable debug logging (JS console warnings) | FALSE |
The values shown above are the built-in defaults used when neither
the function argument nor the corresponding option is set.
dashkit_opt() simply retrieves
getOption("bs4Dashkit.<name>") with a fallback
default supplied by the calling function.
For sidebar modes, valid values are “icon-only”, “icon-text”, and “text-only”.
bs4Dashkit.theme_preset is NULL,
use_bs4Dashkit_core() uses
use_dash_theme().use_dash_theme_preset().Place these in global.R (for Shiny applications) or at
the top or your app.R:
options(
bs4Dashkit.sidebar.collapsed = "icon-only",
bs4Dashkit.sidebar.expanded = "icon-text",
bs4Dashkit.brand_divider = TRUE,
bs4Dashkit.theme_preset = "professional",
bs4Dashkit.accent = "#2f6f8f",
bs4Dashkit.debug = FALSE
)After setting these, you can keep individual calls short:
ttl <- dash_titles(
brand_text = "Dashboard",
icon = "project-diagram"
)
ui <- bs4DashPage(
title = ttl$app_name,
header = bs4DashNavbar(title = ttl$brand),
sidebar = bs4DashSidebar(),
body = bs4DashBody(
use_bs4Dashkit_core(ttl)
)
)Options are just defaults. Any app can override them by supplying arguments.
ttl <- dash_titles(
brand_text = "Special App",
icon = "star",
collapsed = "icon-text",
collapsed_text = "SA",
brand_divider = FALSE
)
body <- bs4DashBody(
use_bs4Dashkit_core(ttl, preset = "minimal", accent = "#6b2f8f")
)