Navbar
The Navbar is a responsive meta-component that serves as a navigation header for your application. It supports branding, links, dropdowns, and forms (like search).
Bootstrap Reference
Quick Start
Visual Examples & Use Cases
1. Positioning & Sticky
Keep the navigation visible while scrolling using sticky="top" or fixed="top".
2. Dark vs Light Themes
Match your application's aesthetic.
3. Adding a Search Form
Navbars are common places for search inputs.
Technical Hierarchy (LLM Spec)
To build a correct Navbar, follow this nested structure:
- Navbar (Main Container)
- Container (Optional, for centered alignment)
- NavbarBrand (Text or Logo)
- NavbarToggler (Created automatically if
expandis set) - NavbarCollapse (Parent for menu items)
- NavItem (Single Link)
- Dropdown (Grouped Links)
- Container (Optional, for centered alignment)
Parameter Reference
| FastStrap Param | Type | Bootstrap Class | Description |
|---|---|---|---|
expand |
str |
.navbar-expand-{val} |
Responsive breakpoint: sm, md, lg, xl. |
variant |
str |
.navbar-{variant} |
Text contrast: light (dark text) or dark (light text). |
bg_variant |
str |
.bg-{variant} |
Background color (e.g., primary, white). |
sticky |
str |
.sticky-top |
Position style. |
fixed |
str |
.fixed-top |
Floating position style. |
faststrap.components.navigation.navbar.Navbar(*children, items=None, brand=None, brand_href='/', variant=None, color_scheme=None, bg=None, expand=None, sticky=None, fixed=None, container=True, **kwargs)
Bootstrap Navbar component for responsive site navigation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
*children
|
Any
|
Navbar content |
()
|
items
|
list[Any] | None
|
Navbar items list (links, buttons, etc.) |
None
|
brand
|
Any | None
|
Brand text or logo |
None
|
brand_href
|
str
|
Brand link URL (default: "/") |
'/'
|
variant
|
str | None
|
Color scheme alias (light or dark text) |
None
|
color_scheme
|
str | None
|
Color scheme (light or dark text) |
None
|
bg
|
str | None
|
Background color class |
None
|
expand
|
ExpandType | None
|
Breakpoint where navbar expands |
None
|
sticky
|
str | None
|
Stick to top or bottom |
None
|
fixed
|
str | None
|
Fix to top or bottom |
None
|
container
|
bool | str
|
Wrap in container |
True
|
**kwargs
|
Any
|
Additional HTML attributes |
{}
|