Buttons in Zero-True
Creating a Button
Creating a button in zero-true is very easy. It’s as simple as
Button Values
Buttons return True when clicked and False otherwise. There is no need to write callbacks, simply reference buttons as follows.
Button Use Cases
Buttons have a ton of potential use cases in zero-true. The example above uses a button to toggle different printed statements but logic can be used to render more complicated layouts.
Expensive Computations
One of the more common patterns for using buttons in zero-true are gating expensive computations, for example:
Creating a Form
Another use case for buttons in zero-true is getting user confirmation before submitting a form. In the example below we save feedback that a user submits in a text area under a .txt file under their name.
Customizing your button
You can also add different colors and labels to your button to make things more interesting. Feel free to play around with all the attributes in the documentation.