SidebarNavbar
SidebarNavbar renders vertical navigation for dashboards, admin panels, and internal tools.
Quick Start
from faststrap import SidebarNavbar
SidebarNavbar(
("Dashboard", "/dashboard", "house"),
("Users", "/users", "people"),
("Settings", "/settings", "gear"),
brand="Ops Console",
theme="dark",
)
Tuple items use (label, href) or (label, href, icon). Icons use Bootstrap Icons names without the bi- prefix.
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
*items |
Any |
Tuple items or SidebarNavItem components. |
|
brand |
str \| None |
None |
Brand label. |
brand_href |
str |
"/" |
Brand link target. |
position |
str \| None |
UNSET |
"left" or "right". |
width |
str \| None |
UNSET |
CSS width value, defaulting to 250px. |
collapsible |
bool \| None |
UNSET |
Adds a sidebar ID for mobile collapse patterns. |
theme |
str \| None |
UNSET |
"dark" or "light". |
sticky |
bool \| None |
UNSET |
Adds sticky-top. |
**kwargs |
Any |
Extra root attributes. |
Individual Items
from faststrap import SidebarNavItem
SidebarNavItem("Dashboard", href="/dashboard", icon="speedometer2", active=True)
Notes
- For full dashboard page composition, pair this with
DashboardLayout. - The component sets
min-height: 100vhand the configured width inline. collapsible=Trueaddsid="sidebarNav"; avoid multiple collapsible sidebars with the same ID on one page.
API Reference
faststrap.components.navigation.sidebar_navbar.SidebarNavbar(*items, brand=None, brand_href='/', position=UNSET, width=UNSET, collapsible=UNSET, theme=UNSET, sticky=UNSET, **kwargs)
Premium vertical sidebar navbar with icon support.
A modern sidebar navigation component perfect for dashboards and admin panels. Fully theme-aware and responsive with mobile collapse support.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
*items
|
Any
|
Navigation items (tuples of (label, href, icon) or SidebarNavItem components) |
()
|
brand
|
str | None
|
Brand name/logo text |
None
|
brand_href
|
str
|
Brand link URL |
'/'
|
position
|
str | None
|
Sidebar position ("left" or "right") |
UNSET
|
width
|
str | None
|
Sidebar width (CSS value, default: "250px") |
UNSET
|
collapsible
|
bool | None
|
Enable mobile collapse |
UNSET
|
theme
|
str | None
|
Theme variant ("light" or "dark") |
UNSET
|
sticky
|
bool | None
|
Make sidebar sticky |
UNSET
|
**kwargs
|
Any
|
Additional HTML attributes |
{}
|
Returns:
| Type | Description |
|---|---|
Div
|
FastHTML Div element with sidebar structure |
Examples:
Basic sidebar:
>>> SidebarNavbar(
... ("Dashboard", "/dashboard", "house"),
... ("Users", "/users", "people"),
... ("Settings", "/settings", "gear"),
... brand="My App",
... theme="dark"
... )
With custom width:
>>> SidebarNavbar(
... ("Home", "/", "house"),
... ("About", "/about", "info-circle"),
... width="300px",
... position="right"
... )
Note
Items can be tuples (label, href, icon) or SidebarNavItem components. Icons use Bootstrap Icons names (without "bi-" prefix).
See Also
- Icon component for icon names
- DashboardLayout for full dashboard setup
Source code in src/faststrap/components/navigation/sidebar_navbar.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 | |
faststrap.components.navigation.sidebar_navbar.SidebarNavItem(label, href='#', icon=None, active=False, theme='dark', **kwargs)
Individual sidebar navigation item.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
Item label text |
required |
href
|
str
|
Link URL |
'#'
|
icon
|
str | None
|
Bootstrap icon name (without "bi-" prefix) |
None
|
active
|
bool
|
Mark as active/selected |
False
|
theme
|
str
|
Theme variant ("light" or "dark") |
'dark'
|
**kwargs
|
Any
|
Additional HTML attributes |
{}
|
Returns:
| Type | Description |
|---|---|
A
|
FastHTML A element with nav-link styling |
Examples: