Przeglądaj źródła

Add index on tabs (#2225)

* Add index on tabs
---------

Co-authored-by: Alek Petuskey <alekpetuskey@aleks-mbp.lan>
Alek Petuskey 1 rok temu
rodzic
commit
065b1b88d2

+ 3 - 0
reflex/components/disclosure/tabs.py

@@ -44,6 +44,9 @@ class Tabs(ChakraComponent):
     # The color scheme of the tabs.
     # The color scheme of the tabs.
     color_scheme: Var[LiteralColorScheme]
     color_scheme: Var[LiteralColorScheme]
 
 
+    # Index of the selected tab (in controlled mode).
+    index: Var[int]
+
     @classmethod
     @classmethod
     def create(
     def create(
         cls, *children, items: Optional[List[Tuple[str, str]]] = None, **props
         cls, *children, items: Optional[List[Tuple[str, str]]] = None, **props

+ 2 - 0
reflex/components/disclosure/tabs.pyi

@@ -106,6 +106,7 @@ class Tabs(ChakraComponent):
                 ],
                 ],
             ]
             ]
         ] = None,
         ] = None,
+        index: Optional[Union[Var[int], int]] = None,
         style: Optional[Style] = None,
         style: Optional[Style] = None,
         key: Optional[Any] = None,
         key: Optional[Any] = None,
         id: Optional[Any] = None,
         id: Optional[Any] = None,
@@ -173,6 +174,7 @@ class Tabs(ChakraComponent):
             orientation: The orientation of the tab list.
             orientation: The orientation of the tab list.
             variant: "line" | "enclosed" | "enclosed-colored" | "soft-rounded" | "solid-rounded" | "unstyled"
             variant: "line" | "enclosed" | "enclosed-colored" | "soft-rounded" | "solid-rounded" | "unstyled"
             color_scheme: The color scheme of the tabs.
             color_scheme: The color scheme of the tabs.
+            index: Index of the selected tab (in controlled mode).
             style: The style of the component.
             style: The style of the component.
             key: A unique key for the component.
             key: A unique key for the component.
             id: The id for the component.
             id: The id for the component.