Skip to content

NavbarModern

NavbarModern is a branded navigation pattern that wraps the core Navbar with sticky and glass styling defaults.

Quick Start

from faststrap import NavbarModern

NavbarModern(
    brand="Faststrap",
    items=[
        ("Docs", "/docs"),
        ("Showcase", "/showcase"),
        ("GitHub", "https://github.com/Faststrap-org/Faststrap"),
    ],
)

Parameters

Parameter Type Default Description
brand Any required Brand content passed to Navbar.
items list[Any] \| None None Navigation items passed to Navbar.
sticky bool True Adds sticky-top.
glass bool True Adds the navbar-glass class.
**kwargs Any Extra attributes passed to Navbar.

Notes

  • This component requires Bootstrap JavaScript because it delegates to Navbar.
  • Use the lower-level Navbar when you need complete control over Bootstrap behavior.
  • Use cls to add brand-specific styling while keeping the default pattern classes.

API Reference

faststrap.components.patterns.navbar.NavbarModern(brand, items=None, sticky=True, glass=True, **kwargs)

A premium, modern navbar with optional glassmorphism.

Parameters:

Name Type Description Default
brand Any

Brand content

required
items list[Any] | None

List of nav items

None
sticky bool

Stick to top

True
glass bool

Apply glassmorphism effect

True
**kwargs Any

Additional attributes

{}

Returns:

Type Description
Nav

Navbar component with modern styling

Note

Marked as @beta - API may change in future releases.

Source code in src/faststrap/components/patterns/navbar.py
@register(category="patterns", requires_js=True)
@beta
def NavbarModern(
    brand: Any,
    items: list[Any] | None = None,
    sticky: bool = True,
    glass: bool = True,
    **kwargs: Any,
) -> Nav:
    """A premium, modern navbar with optional glassmorphism.

    Args:
        brand: Brand content
        items: List of nav items
        sticky: Stick to top
        glass: Apply glassmorphism effect
        **kwargs: Additional attributes

    Returns:
        Navbar component with modern styling

    Note:
        Marked as @beta - API may change in future releases.
    """
    user_cls = kwargs.pop("cls", "")
    classes = ["navbar", "navbar-expand-lg"]
    if glass:
        classes.append("navbar-glass")
    if sticky:
        classes.append("sticky-top")

    all_cls = merge_classes(" ".join(classes), user_cls)
    return Navbar(brand=brand, items=items, cls=all_cls, **kwargs)