File tree Expand file tree Collapse file tree 3 files changed +71
-0
lines changed
api-examples/navbar_options Expand file tree Collapse file tree 3 files changed +71
-0
lines changed Original file line number Diff line number Diff line change 1+ from shiny import App , render , ui
2+
3+ app_ui = ui .page_fluid (
4+ ui .navset_bar (
5+ ui .nav_panel ("A" , "Panel A content" ),
6+ ui .nav_panel ("B" , "Panel B content" ),
7+ ui .nav_panel ("C" , "Panel C content" ),
8+ ui .nav_menu (
9+ "Other links" ,
10+ ui .nav_panel ("D" , "Panel D content" ),
11+ "----" ,
12+ "Description:" ,
13+ ui .nav_control (
14+ ui .a ("Shiny" , href = "https://shiny.posit.co" , target = "_blank" )
15+ ),
16+ ),
17+ id = "selected_navset_bar" ,
18+ title = "Navset Bar" ,
19+ navbar_options = ui .navbar_options (
20+ bg = "#B73A85" ,
21+ theme = "dark" ,
22+ underline = False ,
23+ ),
24+ ),
25+ ui .h5 ("Selected:" ),
26+ ui .output_code ("selected" ),
27+ )
28+
29+
30+ def server (input , output , session ):
31+ @render .code
32+ def selected ():
33+ return input .selected_navset_bar ()
34+
35+
36+ app = App (app_ui , server )
Original file line number Diff line number Diff line change 1+ from shiny .express import input , render , ui
2+
3+ with ui .navset_bar (
4+ title = "Navset Bar" ,
5+ id = "selected_navset_bar" ,
6+ navbar_options = ui .navbar_options (
7+ bg = "#B73A85" ,
8+ theme = "dark" ,
9+ underline = False ,
10+ ),
11+ ):
12+ with ui .nav_panel ("A" ):
13+ "Panel A content"
14+
15+ with ui .nav_panel ("B" ):
16+ "Panel B content"
17+
18+ with ui .nav_panel ("C" ):
19+ "Panel C content"
20+
21+ with ui .nav_menu ("Other links" ):
22+ with ui .nav_panel ("D" ):
23+ "Page D content"
24+
25+ "----"
26+ "Description:"
27+ with ui .nav_control ():
28+ ui .a ("Shiny" , href = "https://shiny.posit.co" , target = "_blank" )
29+ ui .h5 ("Selected:" )
30+
31+
32+ @render .code
33+ def _ ():
34+ return input .selected_navset_bar ()
Original file line number Diff line number Diff line change @@ -1068,6 +1068,7 @@ def __repr__(self):
10681068 return f"navbar_options({ ', ' .join (fields )} )"
10691069
10701070
1071+ @add_example ()
10711072def navbar_options (
10721073 position : MaybeMissing [NavbarOptionsPositionT ] = MISSING ,
10731074 bg : MaybeMissing [str | None ] = MISSING ,
You can’t perform that action at this time.
0 commit comments