GlassNavbar
GlassNavbar renders a premium frosted-glass Bootstrap navbar. It is useful for landing pages and showcase apps where the nav sits over a gradient, image, or layered background.
Quick Start
from faststrap import GlassNavbar
GlassNavbar(
("Home", "/"),
("Features", "/features"),
("Pricing", "/pricing"),
brand="NovaFlow",
blur_strength="medium",
transparency=0.82,
theme="light",
)
Tuple items use (label, href) or (label, href, active).
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
*items |
Any |
Tuple items or custom nav item components. | |
brand |
str \| None |
None |
Brand label. |
brand_href |
str |
"/" |
Brand link target. |
blur_strength |
"low" \| "medium" \| "high" |
UNSET |
Backdrop blur amount. |
transparency |
float \| None |
UNSET |
Background alpha from 0.0 to 1.0. |
theme |
str \| None |
UNSET |
"light" or "dark" styling. |
sticky |
bool \| None |
UNSET |
Adds sticky-top. |
expand |
str \| None |
UNSET |
Collapse breakpoint such as lg or xl. |
**kwargs |
Any |
Extra nav attributes. |
Notes
- Requires Bootstrap JavaScript for the mobile collapse toggler.
- The generated collapse ID is currently
glassNavbarContent, so avoid rendering multipleGlassNavbarcomponents on the same page. - The glass effect depends on browser support for
backdrop-filter.
API Reference
faststrap.components.navigation.glass_navbar.GlassNavbar(*items, brand=None, brand_href='/', blur_strength=UNSET, transparency=UNSET, theme=UNSET, sticky=UNSET, expand=UNSET, **kwargs)
Premium glassmorphism navbar with blur and transparency.
A modern, premium navbar with glassmorphism effect (frosted glass appearance). Fully theme-aware with customizable blur and transparency.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
*items
|
Any
|
Navigation items (tuples of (label, href) or Nav components) |
()
|
brand
|
str | None
|
Brand name/logo text |
None
|
brand_href
|
str
|
Brand link URL |
'/'
|
blur_strength
|
BlurStrength | None
|
Backdrop blur strength ("low", "medium", "high") |
UNSET
|
transparency
|
float | None
|
Background transparency (0.0 to 1.0) |
UNSET
|
theme
|
str | None
|
Theme variant ("light" or "dark") |
UNSET
|
sticky
|
bool | None
|
Make navbar sticky on scroll |
UNSET
|
expand
|
str | None
|
Breakpoint for collapse ("sm", "md", "lg", "xl", "xxl") |
UNSET
|
**kwargs
|
Any
|
Additional HTML attributes |
{}
|
Returns:
| Type | Description |
|---|---|
Nav
|
FastHTML Nav element with glassmorphism styling |
Examples:
Basic glass navbar:
>>> GlassNavbar(
... ("Home", "/"),
... ("About", "/about"),
... ("Contact", "/contact"),
... brand="My App",
... blur_strength="medium",
... theme="light"
... )
High transparency:
>>> GlassNavbar(
... ("Features", "/features"),
... ("Pricing", "/pricing"),
... brand="Product",
... transparency=0.9,
... blur_strength="high"
... )
Note
The glassmorphism effect works best over colorful backgrounds or images. Uses CSS backdrop-filter for the blur effect.
See Also
- Navbar for standard navbar
- SidebarNavbar for vertical sidebar
Source code in src/faststrap/components/navigation/glass_navbar.py
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 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 | |
faststrap.components.navigation.glass_navbar.GlassNavItem(label, href='#', active=False, **kwargs)
Individual glass navbar navigation item.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
Item label text |
required |
href
|
str
|
Link URL |
'#'
|
active
|
bool
|
Mark as active/selected |
False
|
**kwargs
|
Any
|
Additional HTML attributes |
{}
|
Returns:
| Type | Description |
|---|---|
A
|
FastHTML A element with nav-link styling |
Examples: