Change background color of element after clicking

How can I change the color of an element after it’s clicked. I can see that if it’s hovered I can set a color, or while being pressed I can set a color, but not if clicked and have the new color remain.

I have a text field inside of a repeating group. It’s set to change to a lighter color when hovered, and even when pressed I can change the color but it returns to the default color afterward I am no longer pressing or hovering. I’d like the cell’s background color to change and remain after being pressed/clicked.

I need to add a caveat in that when clicking on any other item in my repeating group, the first colored item is returned to the default color. So, only one item in the repeating group should change color at any given time.

I’ve seen the suggestion to set a group state to yes/no and change the color accordingly but this leaves every item in the repeating group that I’ve clicked on as the new color.

I used a custom state to solve this issue.