Toggle button pressed state w/o JavaScript


(Bob) #1

All I’m trying to do is create a checkbox in a form. It’s not an HTML form, just images from Sketch to look like a form. I really need the ability to let the user check the box by clicking and uncheck the box by clicking again.

I’ve tried setting the default, hover, pressed states but I’m struggling to figure out how to toggle between states for the same button.

Please tell me this Is possible without JavaScript. :slight_smile:


(Mark Hunte) #2

Yes it is and probably more than one way…

Here is one using timelines.

Element Checkbox.hype.zip (23.8 KB)

I used text for the check, you can do similar with your images.


Pressed state of a button staying in pressed state ... how?
(Bob) #3

Oh hell, that makes good sense. Well thank you very much for the quick response and the example. You solved my problem. :slight_smile:
Have a great weekend Mark!