Skip to content

Commit 3b278e3

Browse files
authored
docs(navset): Add examples for navset (#1579)
1 parent 97dd4a7 commit 3b278e3

File tree

24 files changed

+485
-22
lines changed

24 files changed

+485
-22
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
from shiny import App, ui
2+
3+
app_ui = ui.page_fluid(
4+
ui.navset_card_underline(
5+
ui.nav_control(ui.a("Shiny", href="https://shiny.posit.co", target="_blank")),
6+
ui.nav_control(
7+
ui.a(
8+
"Learn Shiny",
9+
href="https://shiny.posit.co/py/docs/overview.html",
10+
target="_blank",
11+
)
12+
),
13+
),
14+
id="tab",
15+
)
16+
17+
18+
def server(input, output, session):
19+
pass
20+
21+
22+
app = App(app_ui, server)
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
from shiny.express import ui
2+
3+
with ui.navset_card_underline(id="tab"):
4+
with ui.nav_control():
5+
ui.a("Shiny", href="https://shiny.posit.co", target="_blank")
6+
7+
with ui.nav_control():
8+
ui.a(
9+
"Learn Shiny",
10+
href="https://shiny.posit.co/py/docs/overview.html",
11+
target="_blank",
12+
)
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
from shiny import App, ui
2+
3+
app_ui = ui.page_fluid(
4+
ui.navset_card_pill(
5+
ui.nav_menu(
6+
"Nav Menu items",
7+
ui.nav_panel("A", "Panel A content"),
8+
ui.nav_panel("B", "Panel B content"),
9+
ui.nav_panel("C", "Panel C content"),
10+
),
11+
id="card_pill",
12+
),
13+
)
14+
15+
16+
def server(input, output, session):
17+
pass
18+
19+
20+
app = App(app_ui, server)
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
from shiny.express import ui
2+
3+
with ui.navset_card_pill(id="card_pill"):
4+
with ui.nav_menu("Nav Menu items"):
5+
with ui.nav_panel("A"):
6+
"Page A content"
7+
with ui.nav_panel("B"):
8+
"Page B content"
9+
with ui.nav_panel("C"):
10+
"Page C content"
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
from shiny import App, ui
2+
3+
app_ui = ui.page_fluid(
4+
ui.navset_underline(
5+
ui.nav_panel("A", "Panel A content"),
6+
ui.nav_spacer(),
7+
ui.nav_spacer(),
8+
ui.nav_panel("B", "Panel B content"),
9+
ui.nav_panel("C", "Panel C content"),
10+
id="navset_underline",
11+
)
12+
)
13+
14+
15+
def server(input, output, session):
16+
pass
17+
18+
19+
app = App(app_ui, server)
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
from shiny.express import ui
2+
3+
with ui.navset_underline():
4+
with ui.nav_panel("Tab 1"):
5+
"Tab 1 content"
6+
ui.nav_spacer()
7+
ui.nav_spacer()
8+
with ui.nav_panel("Tab 2"):
9+
"Tab 2 content"
10+
with ui.nav_panel("Tab 3"):
11+
"Tab 3 content"
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
from shiny import App, 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="tab",
18+
title="Navset Bar",
19+
)
20+
)
21+
22+
23+
def server(input, output, session):
24+
pass
25+
26+
27+
app = App(app_ui, server)
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
from shiny.express import ui
2+
3+
with ui.navset_bar(title="Navset Bar", id="tab"):
4+
with ui.nav_panel("A"):
5+
"Panel A content"
6+
7+
with ui.nav_panel("B"):
8+
"Panel B content"
9+
10+
with ui.nav_panel("C"):
11+
"Panel C content"
12+
13+
with ui.nav_menu("Other links"):
14+
with ui.nav_panel("D"):
15+
"Page D content"
16+
17+
"----"
18+
"Description:"
19+
with ui.nav_control():
20+
ui.a("Shiny", href="https://shiny.posit.co", target="_blank")
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
from shiny import App, ui
2+
3+
app_ui = ui.page_fluid(
4+
ui.navset_card_pill(
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="tab",
18+
)
19+
)
20+
21+
22+
def server(input, output, session):
23+
pass
24+
25+
26+
app = App(app_ui, server)
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
from shiny.express import ui
2+
3+
with ui.navset_card_pill(id="tab"):
4+
with ui.nav_panel("A"):
5+
"Panel A content"
6+
7+
with ui.nav_panel("B"):
8+
"Panel B content"
9+
10+
with ui.nav_panel("C"):
11+
"Panel C content"
12+
13+
with ui.nav_menu("Other links"):
14+
with ui.nav_panel("D"):
15+
"Page D content"
16+
17+
"----"
18+
"Description:"
19+
with ui.nav_control():
20+
ui.a("Shiny", href="https://shiny.posit.co", target="_blank")

0 commit comments

Comments
 (0)