A simple toggle switch Blaze component for Meteor.
Why this package?
Well because we cannot just copy a Blaze component in each and every package or application which would need it:
This Meteor package is installable with the usual command:
meteor add pwix:toggle-switch
Very simple:
{{> toggleSwitch (switchParms) }}
switchParms(){
return {
labelLeft: 'my label'
}
}
toggleSwitch
A simple toggle switch:
an example with a labelBottom
set, switch is « On »
an example with a labelBottom
set, switch is « Off »
an example with labelTop
and labelBottom
set
an example with labelLeft
and labelRight
set
The component is configurable with an object passed as an argument, which may contain:
name
A string which is expected to uniquely identify the toggle switch.
labelTop
labelRight
labelBottom
labelLeft
An HTML string to be displayed above (resp. on the right, below, on the left) of the button, defaulting to none.
title
A string to be used as the button title, defaulting to none.
state
Whether the switch is initially « On », defaulting to true
.
enabled
Whether the switch is enabled, defaulting to true
.
ts-answer
The message is triggered as an answer to ts-request
received event.
It holds associated { name: <name>, state: <state>, enable: <enabled> }
data.
ts-state
The message is triggered each time the state of the toggle switch changes.
It holds associated { name: <name>, state: <new_state> }
data, where <new_state> is true
(resp. false
) when switch is « On » (resp. « Off »).
ts-request
The message can be sent to the toggleSwitch
component class to request a ts-answer
answer.
None at the moment.
None at the moment.
None at the moment.
None at the moment.
In case of support or error, please report your issue request to our Issues tracker.
P. Wieser