Skip to content

Bug / Feature Request: Expand Sidebar NavItems with ParentId on Initial Load #1161

@Torchok19081986

Description

@Torchok19081986

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions