The documentation says a button can be formatted to toggle on or off, but the example given is merely
Vote
&
The easiest way to get the toggle buttons working without any options etc is the following:
$('.ui.button.toggle').state();
This should toggle between the default grey and green colors on click. See the other answers for more complicated behaviour. Make sure the DOM etc is loaded first as with other semantic UI initializers.