Switch
The Bootstrap
switch
form component, implemented in Ruby. Use it like any of the other matestack form components in your apps, pages and components. It offers customizable options to simply achieve what is possible in bootstrap with this component. See below for more information about the configuration options.Renders one or multiple bootstrap switch input fields.
Optional options
label
- Expects a string, gets displayed before the first input fieldform_text
- Expects a string, gets displayed after the last input fielddisabled
- If set to:true
, the switch input fields are set to disabled and clicking them doesn't yield any effectvariant
- If set to:inline
, the wrappingdiv
is displayed asinline-block
instead of the defaultblock
bs_form_switch key: :some_switch_input, label: 'Some input'
and sends
"some_switch_input"=>nil # or true, if the input has been clicked or false if the input was clicked again
to the corresponding Controller.
bs_form_switch key: :foo, options: [1, 2]
bs_form_switch key: :foo, options: { "Option 1": 1, "Option 2": 2 }
bs_form_switch key: :foo, options: [1, 2], label: "Some label"
bs_form_switch key: :foo, options: { "Option 1": 1, "Option 2": 2 }
bs_form_switch key: :foo, options: [1, 2], disabled: true
bs_form_switch key: :foo, options: { "Option 1": 1, "Option 2": 2 }
Last modified 1yr ago