-
-
Notifications
You must be signed in to change notification settings - Fork 88
Description
Currently, when using with a DataProvider, NavItems that have a ParentId are not expanded by default on initial load – only the top-level items are visible. This is confusing for users, especially when a sub-item is the current active route, but its parent menu is collapsed.
There seems to be no property or method to control the expanded/collapsed state of sidebar groups on load, or to programmatically expand specific NavItems based on the current route.
✅ Expected Behavior
When a sub-NavItem is active (i.e., its route matches the current URL), its parent group should be automatically expanded.
Alternatively, a way to control the expanded state (e.g., via IsExpanded, or callback in SidebarDataProvider) should be available.
new NavItem
{
Id = "parent1",
Text = "Parent Menu",
IconName = IconName.Folder,
Url = null,
},
new NavItem
{
ParentId = "parent1",
Text = "Child Page",
Url = "/childpage"
}
If the current page is /childpage, the menu is collapsed and "Child Page" is hidden unless the user clicks to expand "Parent Menu".
Suggested Solutions
Automatically expand parent groups if any of their children is Active=true.
Add an IsExpanded property to NavItem.
Provide a callback/hook during SidebarDataProvider execution to allow logic-based expansion.