express.ui.nav_menu
Context manager for a menu of nav items.
This function wraps nav_menu
.
Parameters
title : TagChild
-
A title to display. Can be a character string or UI elements (i.e., tags).
value : Optional[str] = None
-
The value of the item. This is used to determine whether the item is active (when an
id
is provided to the nav container), programmatically select the item (e.g.,update_navs
), and/or be provided to theselected
argument of the navigation container (e.g.,navset_tab
). icon : TagChild = None
-
An icon to appear inline with the button/link.
align : Literal[‘left’, ‘right’] = 'left'
-
Horizontal alignment of the dropdown menu relative to dropdown toggle.
Examples
#| standalone: true
#| components: [editor, viewer]
#| layout: vertical
#| viewerHeight: 400
## file: app.py
from shiny.express import input, render, ui
with ui.navset_card_pill(id="selected_card_pill"):
with ui.nav_menu("Nav Menu items"):
with ui.nav_panel("A"):
"Page A content"
with ui.nav_panel("B"):
"Page B content"
with ui.nav_panel("C"):
"Page C content"
ui.h5("Selected:")
@render.code
def _():
return input.selected_card_pill()