How to toggle icon in button

Probably the most simple question ever…
I have a button and I want it to toggle and change the icon contained within it.

  • The button class is btn and I have set ‘Action toggle’ to Button under properties.
    Not sure what next stage is…
    Do I add a variable checking state of button?
    How do I use class toggle under dynamic attributes?

What do you want to toggle using this button?

Its a favourite button so a boolean value in the db

So you can use a regular button, set the value in the database and based on this value you can set a class and show/hide the icon.

So you need an update record action which updates your value in the db. Then you need a database query to return this value from the db.
On update - run the query to get the value from the db and use it to style your button.

Makes sense… great thanks Teodor