Skip to content

Commit 101c2ae

Browse files
committed
docs(navs): Improve examples for recommended usage; rstudio/bslib#848
1 parent 28f1d6f commit 101c2ae

File tree

3 files changed

+39
-37
lines changed

3 files changed

+39
-37
lines changed

shiny/api-examples/nav/app.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,24 +8,24 @@ def nav_controls(prefix: str) -> List[NavSetArg]:
88
return [
99
ui.nav("a", prefix + ": tab a content"),
1010
ui.nav("b", prefix + ": tab b content"),
11-
ui.nav_control(
12-
ui.a(
13-
"Shiny",
14-
href="https://github.com/rstudio/shiny",
15-
target="_blank",
16-
)
17-
),
11+
ui.nav("c", prefix + ": tab c content"),
1812
ui.nav_spacer(),
1913
ui.nav_menu(
20-
"Other links",
21-
ui.nav("c", prefix + ": tab c content"),
14+
"Links",
15+
ui.nav_control(
16+
ui.a(
17+
"Shiny",
18+
href="https://shiny.posit.co/py/",
19+
target="_blank",
20+
)
21+
),
2222
"----",
2323
"Plain text",
2424
"----",
2525
ui.nav_control(
2626
ui.a(
27-
"RStudio",
28-
href="https://rstudio.com",
27+
"Posit",
28+
href="https://posit.co",
2929
target="_blank",
3030
)
3131
),

tests/e2e/TODO/navbar/app.py

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13,29 +13,31 @@ def nav_with_content(letter: str, prefix: str) -> ui._navs.Nav:
1313
def nav_items(prefix: str) -> list[NavSetArg]:
1414
a = nav_with_content("a", prefix)
1515
b = nav_with_content("b", prefix)
16-
github = ui.nav_control(
17-
ui.tags.a(
18-
# ui.icon("github"),
19-
"Shiny",
20-
href="https://github.com/rstudio/shiny",
21-
target="_blank",
22-
),
23-
)
16+
c = nav_with_content("c", prefix)
2417
space = ui.nav_spacer()
25-
other = ui.nav_menu(
26-
"Other links",
27-
nav_with_content("c", prefix),
18+
links = ui.nav_menu(
19+
"Links",
2820
ui.nav_control(
2921
ui.tags.a(
30-
# icon("r-project"),
31-
"RStudio",
32-
href="https://rstudio.com",
22+
# ui.icon("github"),
23+
"Shiny",
24+
href="https://github.com/posit-dev/py-shiny",
3325
target="_blank",
3426
),
3527
),
28+
"---",
29+
"Plain text",
30+
"---",
31+
ui.nav_control(
32+
ui.a(
33+
"Posit",
34+
href="https://posit.co",
35+
target="_blank",
36+
)
37+
),
3638
align="right",
3739
)
38-
return [a, b, github, space, other]
40+
return [a, b, c, space, links]
3941

4042

4143
app = App(

tests/e2e/navs/nav/app.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,24 +8,24 @@ def nav_controls(prefix: str) -> List[NavSetArg]:
88
return [
99
ui.nav("A", prefix + ": tab a content", value="a"),
1010
ui.nav("B", prefix + ": tab b content", value="b"),
11-
ui.nav_control(
12-
ui.a(
13-
"Shiny",
14-
href="https://github.com/rstudio/shiny",
15-
target="_blank",
16-
)
17-
),
11+
ui.nav("C", prefix + ": tab c content", value="c"),
1812
ui.nav_spacer(),
1913
ui.nav_menu(
20-
"Other links",
21-
ui.nav("C", prefix + ": tab c content", value="c"),
14+
"Links",
15+
ui.nav_control(
16+
ui.a(
17+
"Shiny",
18+
href="https://shiny.posit.co/py/",
19+
target="_blank",
20+
)
21+
),
2222
"----",
2323
"Plain text",
2424
"----",
2525
ui.nav_control(
2626
ui.a(
27-
"RStudio",
28-
href="https://rstudio.com",
27+
"Posit",
28+
href="https://posit.co",
2929
target="_blank",
3030
)
3131
),

0 commit comments

Comments
 (0)