An add-on Meteor package for aldeed:autoform. Provides a single custom input type, "bootstrap-switch", which renders an input using the bootstrap-switch plugin.
The plugin library must be installed separately.
In a Meteor app directory, enter:
$ meteor add ctjp:meteor-bootstrap-switch
$ meteor add aldeed:autoform
In a Meteor app directory, enter:
$ meteor add ctjp:autoform-bootstrap-switch
Specify "bootstrap-switch" for the type
attribute of any input. This can be done in a number of ways:
In the schema, which will then work with a quickForm
or afQuickFields
:
{
enabled: {
type: Boolean,
defaultValue: true,
autoform: {
type: 'bootstrap-switch',
afFieldInput: {
switchOptions: {
size: 'small',
onColor: 'success'
}
}
}
}
}
Or on the afFieldInput
component or any component that passes along attributes to afFieldInput
:
{{> afQuickField name="enabled" type="bootstrap-switch" switchOptions=helperFunction}}
{{> afFormGroup name="enabled" type="bootstrap-switch" switchOptions=helperFunction}}
{{> afFieldInput name="enabled" type="bootstrap-switch" switchOptions=helperFunction}}
To provide bootstrap-switch options, set a switchOptions
attribute equal to a helper that returns the options object.