Sidebar
Description
Create a collapsible sidebar for navigation.
Usage
bc_sidebar(
id = NULL,
...,
side = "left",
header = NULL,
footer = NULL,
aria_label = "Sidebar navigation",
initial_open = NULL,
initial_mobile_open = NULL,
breakpoint = NULL
)
bc_sidebar_group(title, ..., id = NULL)
bc_sidebar_item(
label,
href = NULL,
...,
icon = NULL,
variant = "default",
size = "default",
active = FALSE,
disabled = FALSE,
aria_current = FALSE,
keep_mobile_open = FALSE
)
bc_sidebar_submenu(
label,
...,
id = NULL,
icon = NULL,
variant = "default",
size = "default",
active = FALSE,
keep_mobile_open = FALSE
)
bc_sidebar_separator()
Arguments
| Argument | Description |
|---|---|
id |
String or NULL. The ID. bc_sidebar_group() and bc_sidebar_submenu() use a random ID when NULL. With bc_shiny_deps(), input$id is TRUE while a bc_sidebar() given an id is open. |
... |
For bc_sidebar_group() and bc_sidebar_submenu(), items such as bc_sidebar_item(). For bc_sidebar_item(), extra tag attributes. |
side |
String. The side of the page, "left" (default) or "right". |
header |
Tag or NULL. Content for the top of the sidebar, such as a logo or workspace picker. |
footer |
Tag or NULL. Content for the bottom of the sidebar, such as an account menu. |
aria_label |
String. Accessible name for the sidebar. Defaults to "Sidebar navigation". |
initial_open |
Bool or NULL. Whether the sidebar starts open on wide screens. |
initial_mobile_open |
Bool or NULL. Whether the sidebar starts open on small screens. |
breakpoint |
String or NULL. The screen width below which the sidebar switches to its mobile layout, such as "48rem". |
title |
String. The group title, also used as its accessible name. |
label |
String. Text shown on the item or submenu. |
href |
String or NULL. A link URL. NULL makes a button. |
icon |
Tag or NULL. An icon shown before the label, such as one from the phosphoricons package. |
variant |
String. One of default, outline. |
size |
String. One of default, sm, lg. |
active |
Bool. Highlight the item as active. Defaults to FALSE. |
disabled |
Bool. Whether the item is disabled. Defaults to FALSE. |
aria_current |
Bool. Mark the item as the current page for screen readers. Defaults to FALSE. |
keep_mobile_open |
Bool. Keep the mobile sidebar open when the item is clicked. Defaults to FALSE. |
Value
An htmltools tag.
Examples
bc_sidebar(
id = "sidebar",
bc_sidebar_group(
"Getting started",
bc_sidebar_item("Playground", href = "#", aria_current = TRUE),
bc_sidebar_item("Models", href = "#"),
bc_sidebar_submenu(
"Settings",
bc_sidebar_item("General", href = "#"),
bc_sidebar_item("Limits", href = "#")
)
),
bc_sidebar_separator(),
bc_sidebar_group(
"Account",
bc_sidebar_item("Billing", href = "#")
)
)
bs_group <- bc_sidebar_group(
"Workspace",
bc_sidebar_item("Dashboard", href = "#")
)
bc_sidebar_item("Profile", href = "/profile", aria_current = TRUE)
Profile
bc_sidebar_submenu(
"Settings",
bc_sidebar_item("General", href = "#")
)