diff --git a/kivymd/uix/navigationbar/navigationbar.py b/kivymd/uix/navigationbar/navigationbar.py index e2f45cc05..5517b8194 100644 --- a/kivymd/uix/navigationbar/navigationbar.py +++ b/kivymd/uix/navigationbar/navigationbar.py @@ -585,6 +585,20 @@ def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) Clock.schedule_once(self.set_status_bar_color) + def get_active_item(self) -> MDNavigationItem | None: + """ + Returns the currently active item in the navigation bar. + + :return: The active :class:`~kivymd.uix.navigationbar.MDNavigationItem` + instance if found, otherwise `None`. + + """ + + for child in self.children: + if child.active: + return child + return None + def set_active_item(self, item: MDNavigationItem) -> None: """Sets the currently active element on the panel."""