Looking for a heart-like-toggle

Hi, I’m searching for a toggle-plugin which is like the heart-like-toggle on Instagram.
Can somebody recommend something?
Best wishes

You can use heart icon for this. When user clicks on it you can change its color.

1 Like

Ok thanks:)

When the icon is pressed, the color changes, but how can I program that it stayes red until the toggle is clicked again?

Hi there, @Jakob1… as you found out, the is pressed operator means literally while the icon is being pressed, and that is obviously not what you want. In order to implement the toggle functionality, you will have to store a value in a field so you can refer to that value to see if a particular user has clicked the heart.

Let’s say, for example, you are implementing this toggle on blog posts so a user can like a particular post. In that case, you might have a list field on the blog post data type that stores a list of users who have liked the post. With that field in place, you could create a conditional that says when a particular blog post’s list of users field contains the current user, change the color of the heart to red.

So, it’s all about what you need the heart icon for and where you decide to store an associated value in your data types.

Hope this helps.


1 Like

Thank you very much, this helps a lot :smiley:

1 Like