ui.navbar_options
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) andbgis provided, the best contrast tobgis 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
#| '!! shinylive warning !!': |
#| shinylive does not work in self-contained HTML documents.
#| Please set `embed-resources: false` in your metadata.
#| standalone: true
#| components: [editor, viewer]
#| layout: vertical
#| viewerHeight: 400
## file: app.py
from shiny import App, render, ui
app_ui = ui.page_fluid(
ui.navset_bar(
ui.nav_panel("A", "Panel A content"),
ui.nav_panel("B", "Panel B content"),
ui.nav_panel("C", "Panel C content"),
ui.nav_menu(
"Other links",
ui.nav_panel("D", "Panel D content"),
"----",
"Description:",
ui.nav_control(
ui.a("Shiny", href="https://shiny.posit.co", target="_blank")
),
),
id="selected_navset_bar",
title="Navset Bar",
navbar_options=ui.navbar_options(
bg="#B73A85",
theme="dark",
underline=False,
),
),
ui.h5("Selected:"),
ui.output_code("selected"),
)
def server(input, output, session):
@render.code
def selected():
return input.selected_navset_bar()
app = App(app_ui, server)