Skip to content

Commit aea3413

Browse files
authored
fix: Updating nav cards to have full screen option (#2063)
1 parent 2ceaa36 commit aea3413

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1313

1414
### New features
1515

16+
* `navset_card_*()` now has a `full_screen` option to support `card()`'s existing full-screen functionality. (#1451)
17+
1618
* Added `ui.insert_nav_panel()`, `ui.remove_nav_panel()`, and `ui.update_nav_panel()` to support dynamic navigation. (#90)
1719

1820
* Added support for python 3.13. (#1711)

shiny/ui/_navs.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -652,6 +652,7 @@ def __init__(
652652
selected: Optional[str],
653653
title: Optional[TagChild] = None,
654654
sidebar: Optional[Sidebar] = None,
655+
full_screen: bool = False,
655656
header: TagChild = None,
656657
footer: TagChild = None,
657658
placement: Literal["above", "below"] = "above",
@@ -666,6 +667,7 @@ def __init__(
666667
)
667668
self.title = title
668669
self.sidebar = sidebar
670+
self.full_screen = full_screen
669671
self.placement = placement
670672

671673
def layout(self, nav: Tag, content: Tag) -> Tag:
@@ -696,6 +698,7 @@ def layout(self, nav: Tag, content: Tag) -> Tag:
696698
card_header(*nav_items) if self.placement == "above" else None,
697699
*contents,
698700
card_footer(*nav_items) if self.placement == "below" else None,
701+
full_screen=self.full_screen,
699702
)
700703

701704

@@ -706,6 +709,7 @@ def navset_card_tab(
706709
selected: Optional[str] = None,
707710
title: Optional[TagChild] = None,
708711
sidebar: Optional[Sidebar] = None,
712+
full_screen: bool = False,
709713
header: TagChild = None,
710714
footer: TagChild = None,
711715
) -> NavSetCard:
@@ -724,6 +728,9 @@ def navset_card_tab(
724728
``value``).
725729
sidebar
726730
A `Sidebar` component to display on every `nav()` page.
731+
full_screen
732+
If `True`, an icon will appear when hovering over the card body. Clicking the
733+
icon expands the card to fit viewport size.
727734
header
728735
UI to display above the selected content.
729736
footer
@@ -755,6 +762,7 @@ def navset_card_tab(
755762
selected=selected,
756763
title=title,
757764
sidebar=sidebar,
765+
full_screen=full_screen,
758766
header=header,
759767
footer=footer,
760768
placement="above",
@@ -768,6 +776,7 @@ def navset_card_pill(
768776
selected: Optional[str] = None,
769777
title: Optional[TagChild] = None,
770778
sidebar: Optional[Sidebar] = None,
779+
full_screen: bool = False,
771780
header: TagChild = None,
772781
footer: TagChild = None,
773782
placement: Literal["above", "below"] = "above",
@@ -787,6 +796,9 @@ def navset_card_pill(
787796
``value``).
788797
sidebar
789798
A :class:`shiny.ui.Sidebar` component to display on every :func:`~shiny.ui.nav_panel` page.
799+
full_screen
800+
If `True`, an icon will appear when hovering over the card body. Clicking the
801+
icon expands the card to fit viewport size.
790802
header
791803
UI to display above the selected content.
792804
footer
@@ -820,6 +832,7 @@ def navset_card_pill(
820832
selected=selected,
821833
title=title,
822834
sidebar=sidebar,
835+
full_screen=full_screen,
823836
header=header,
824837
footer=footer,
825838
placement=placement,
@@ -833,6 +846,7 @@ def navset_card_underline(
833846
selected: Optional[str] = None,
834847
title: Optional[TagChild] = None,
835848
sidebar: Optional[Sidebar] = None,
849+
full_screen: bool = False,
836850
header: TagChild = None,
837851
footer: TagChild = None,
838852
placement: Literal["above", "below"] = "above",
@@ -852,6 +866,9 @@ def navset_card_underline(
852866
``value``).
853867
sidebar
854868
A :class:`shiny.ui.Sidebar` component to display on every :func:`~shiny.ui.nav_panel` page.
869+
full_screen
870+
If `True`, an icon will appear when hovering over the card body. Clicking the
871+
icon expands the card to fit viewport size.
855872
header
856873
UI to display above the selected content.
857874
footer
@@ -885,6 +902,7 @@ def navset_card_underline(
885902
selected=selected,
886903
title=title,
887904
sidebar=sidebar,
905+
full_screen=full_screen,
888906
header=header,
889907
footer=footer,
890908
placement=placement,

0 commit comments

Comments
 (0)