function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
jojoforcejojoforce 

Sticky and persistent menu selection in lightning component

I have a lightning component tab, that has a lightning component with lightning:buttonMenu.

However, when I go back to the lightning component tab, I'd like the menu button to retain what was selected sort of cache the last selected menu item and make them sticky.Is there a way to make them sticky? 

For example below... I selected "Menu Item Three". if I go to a different page for example an Account Record Page then I go back to the Lightning Component Tab, I'd like "Menu Item Three" to show that was my last selection.

User-added image

 




 
SwethaSwetha (Salesforce Developers) 
HI jojoforce,
I have not come across a code snippet that exactly matches your ask but the below might give an idea on implementing sticky header

https://salesforce.stackexchange.com/questions/171044/lightning-create-sticky-button
https://salesforce.stackexchange.com/questions/206072/sticky-header-in-custom-lightning-page-template-component
https://salesforce.stackexchange.com/questions/92132/fixed-page-header-in-lightning-design-system

Thank you