Expandable side menu to recognize size on page change

I have a side menu that starts out expanded, but with a hamburger menu the user has the option to shrink it so it just icons… I have it working but am wandering how I can have it remember what state it is in when a new page is clicked. So it doesnt just go back to expanded view every time the page changes. Would this require some javascript?


To remember the state of your side menu across page changes, you’ll likely need to use JavaScript to store and retrieve the menu state. One approach could be using localStorage to save whether the menu is expanded or collapsed based on user interaction. Then, when a new page is loaded, you can check localStorage and set the menu accordingly. It’s a common technique and should work well for your scenario.