express.ui.navbar_options

express.ui.navbar_options(
    position=MISSING,
    bg=MISSING,
    theme=MISSING,
    underline=MISSING,
    collapsible=MISSING,
    **attrs,
)

Configure the appearance and behavior of the navbar.

Parameters

position : NavbarOptionsPositionType | MISSING_TYPE = MISSING

Determines whether the navbar should be displayed at the top of the page with normal scrolling behavior ("static-top"), pinned at the top ("fixed-top"), or pinned at the bottom ("fixed-bottom"). Note that using "fixed-top" or "fixed-bottom" will cause the navbar to overlay your body content, unless you add padding (e.g., tags.style("body {padding-top: 70px;}"))

bg : str | None | MISSING_TYPE = MISSING

Background color of the navbar (a CSS color).

theme : NavbarOptionsThemeType | MISSING_TYPE = MISSING

The navbar theme: either "dark" for a light text color (on a dark background) or "light" for a dark text color (on a light background). If "auto" (the default) and bg is provided, the best contrast to bg is chosen.

underline : bool | MISSING_TYPE = MISSING

If True, adds an underline effect to the navbar.

collapsible : bool | MISSING_TYPE = MISSING

If True, automatically collapses the elements into an expandable menu on mobile devices or narrow window widths.

attrs : TagAttrValue = {}

Additional HTML attributes to apply to the navbar container element.

Returns:

NavbarOptions A NavbarOptions object configured with the specified options.

Examples

#| standalone: true
#| components: [editor, viewer]
#| layout: vertical
#| viewerHeight: 400

## file: app.py
from shiny.express import input, render, ui

with ui.navset_bar(
    title="Navset Bar",
    id="selected_navset_bar",
    navbar_options=ui.navbar_options(
        bg="#B73A85",
        theme="dark",
        underline=False,
    ),
):
    with ui.nav_panel("A"):
        "Panel A content"

    with ui.nav_panel("B"):
        "Panel B content"

    with ui.nav_panel("C"):
        "Panel C content"

    with ui.nav_menu("Other links"):
        with ui.nav_panel("D"):
            "Page D content"

        "----"
        "Description:"
        with ui.nav_control():
            ui.a("Shiny", href="https://shiny.posit.co", target="_blank")
ui.h5("Selected:")


@render.code
def _():
    return input.selected_navset_bar()