This repository was archived by the owner on Jun 14, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Toggle
Steve Ruiz edited this page Feb 3, 2018
·
2 revisions
A toggle has two states, on and off, and has two buttons for selecting the state.
myToggle = new Toggle
#options: ['Off', 'On']
#icon: false
#toggled: false
The toggle's two button labels, provided as an array of two strings. The toggle will use the strings as labels for the toggle's on and off buttons. Generally speaking, the more affirmative option should be the second string. Constructor only.
myToggle = new Toggle
options: ['Inactive', 'Active']
Whether to use the strings provided in options as icon names, rather than text labels. If set to true, the Toggle will show (or attempt to show) icons using the options strings provided. Constructor only.
myToggle = new Toggle
options: ['pizza', 'apple']
icon: true
Whether the toggle should be toggled or not. If true, the right-hand button will be active. If false, the left-hand button will be active.
myToggle = new Toggle
toggled: true
myToggle.toggled = false
myToggle.on "change:toggled", (value) ->
print "Is toggle toggled? " + value