Dynamic Button active style

Helllo Frinds,

I have Q I hope u could help me
I create unknown number of dynamic buttons. The problem is that I want to add active to the clicked button
I tried with match where i send new style, it worked but it changed all the buttons the I will click it and change there style to the new style I just sent so all clicked button will take the new style

I need to send the new style only for clicked one and update the other to original style ‘hard coded on the button’.

or another solution

CSS only hover works active didn’t work
thanks guys