ui.page_navbar
ui.page_navbar(
*args,
title=None,
id=None,
selected=None,
sidebar=None,
fillable=False,
fillable_mobile=False,
gap=None,
padding=None,
position='static-top',
header=None,
footer=None,
bg=None,
inverse=False,
underline=True,
collapsible=True,
fluid=True,
window_title=MISSING,
lang=None,
theme=None,
)
Create a page with a navbar and a title.
Parameters
*args : NavSetArg | MetadataNode | Sequence[MetadataNode] = ()
-
UI elements.
title : Optional[str | Tag | TagList] = None
-
The browser window title (defaults to the host URL of the page). Can also be set as a side effect via
panel_title
. id : Optional[str] = None
-
If provided, will create an input value that holds the currently selected nav item.
selected : Optional[str] = None
-
Choose a particular nav item to select by default value (should match its
value
). sidebar : Optional[Sidebar] = None
-
A
sidebar
component to display on every page. fillable : bool |
list
[str] = False-
Whether or not the main content area should be considered a fillable (i.e., flexbox) container.
fillable_mobile : bool = False
-
Whether or not
fillable
should apply on mobile devices. gap : Optional[CssUnit] = None
-
A CSS length unit defining the gap (i.e., spacing) between elements provided to
*args
. This value is only used when the navbar is fillable. padding : Optional[CssUnit |
list
[CssUnit]] = None-
Padding to use for the body. This can be a numeric vector (which will be interpreted as pixels) or a character vector with valid CSS lengths. The length can be between one and four. If one, then that value will be used for all four sides. If two, then the first value will be used for the top and bottom, while the second value will be used for left and right. If three, then the first will be used for top, the second will be left and right, and the third will be bottom. If four, then the values will be interpreted as top, right, bottom, and left respectively. This value is only used when the navbar is fillable.
position : Literal[‘static-top’, ‘fixed-top’, ‘fixed-bottom’] = 'static-top'
-
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;}")
). header : Optional[TagChild] = None
-
UI to display above the selected content.
footer : Optional[TagChild] = None
-
UI to display below the selected content.
bg : Optional[str] = None
-
Background color of the navbar (a CSS color).
inverse : bool = False
-
Either
True
for a light text color orFalse
for a dark text color. collapsible : bool = True
-
True
to automatically collapse the elements into an expandable menu on mobile devices or narrow window widths. fluid : bool = True
-
True
to use fluid layout;False
to use fixed layout. window_title : str | MISSING_TYPE = MISSING
-
The browser’s window title (defaults to the host URL of the page). Can also be set as a side effect via
panel_title
. lang : Optional[str] = None
-
ISO 639-1 language code for the HTML page, such as
"en"
or"ko"
. This will be used as the lang in the<html>
tag, as in<html lang="en">
. The default,None
, results in an empty string. theme : Optional[str | Path |
Theme
|ThemeProvider
] = None-
A custom Shiny theme created using the
Theme
class, or a path to a local or online CSS file that will replace the Bootstrap CSS bundled by default with a Shiny app. This file should be a completebootstrap.css
orbootstrap.min.css
file. For advanced uses, you can also pass aTagifiable
object. In this case, Shiny will suppress the default Bootstrap CSS. To modify the theme of an app without replacing the Bootstrap CSS entirely, useinclude_css
to add custom CSS.
Returns
: Tag
-
A UI element.
See Also
Example
See nav
.