Skip to content

Commit

Permalink
Merge pull request #1897 from CrystalWindSnake/main
Browse files Browse the repository at this point in the history
make ui.tab_panels can work with other components
  • Loading branch information
falkoschindler authored Oct 27, 2023
2 parents e9c8c78 + aae0154 commit 7899abb
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions nicegui/elements/tabs.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def __init__(self, name: str, label: Optional[str] = None, icon: Optional[str] =
class TabPanels(ValueElement):

def __init__(self,
tabs: Tabs, *,
tabs: Optional[Tabs] = None, *,
value: Union[Tab, TabPanel, str, None] = None,
on_change: Optional[Callable[..., Any]] = None,
animated: bool = True,
Expand All @@ -65,14 +65,15 @@ def __init__(self,
this element uses Vue's `keep-alive <https://vuejs.org/guide/built-ins/keep-alive.html>`_ component.
If client-side performance is an issue, you can disable this feature.
:param tabs: the `ui.tabs` element that controls this element
:param tabs: an optional `ui.tabs` element that controls this element
:param value: `ui.tab`, `ui.tab_panel`, or name of the tab panel to be initially visible
:param on_change: callback to be executed when the visible tab panel changes
:param animated: whether the tab panels should be animated (default: `True`)
:param keep_alive: whether to use Vue's keep-alive component on the content (default: `True`)
"""
super().__init__(tag='q-tab-panels', value=value, on_value_change=on_change)
tabs.bind_value(self, 'value')
if tabs is not None:
tabs.bind_value(self, 'value')
self._props['animated'] = animated
self._props['keep-alive'] = keep_alive

Expand Down

0 comments on commit 7899abb

Please sign in to comment.