Frontend-only variable

Hi all,
I use the “conditional” card to hide/show UI elements based on a button press. Right now I use boolean helpers as the condition that displays the elements, with the button toggling its value, but it’s hardly ideal, there’s some lag when opening the app and if I press a button on one device it toggles visibility in all of them.

I’d like to use a variable local to each device, like a simple javascript variable, but I can’t find out how to implement one. Is there a way to do this in Lovelace?

Maybe this: