How to default a navigation group to collapsed on first load?
->navigationGroups([
NavigationGroup::make()
->label('Users')
->icon('heroicon‑o-users')
->collapsible()
])
I’m building an admin panel with a "Users" navigation group, which contains Roles, Permissions, and Users submenu items.
However, whenever I first load the page, the group is always expanded by default—even if I haven’t clicked anything. I’d like the submenu to start collapsed (hidden), and only expand when the user clicks the group icon.
🙏 Would love to hear your approaches or insights here—thanks!

Solution:Jump to solution
yeah, by modifying localstorage key collapsedGroups in render hook resolved the issue.
Here is my updated code in panelprovider
https://codeshare.io/5Od9Dr...
2 Replies
I think the state is loaded form localStorage so you’d need to overwrite that before Alpine initializes. You can either register a JS (not sure if that in time) or add some JS via a render hook
Solution
yeah, by modifying localstorage key collapsedGroups in render hook resolved the issue.
Here is my updated code in panelprovider
https://codeshare.io/5Od9Dr