Components.ButtonGroup Class
Bootstrap-style button group, that visually groups buttons, and optionally adds radio/checkbox like behaviour. See http://getbootstrap.com/components/#btn-groups
Use as a block level component with any number of Components.Button components as children:
{{#bs-button-group}}
{{#bs-button}}1{{/bs-button}}
{{#bs-button}}2{{/bs-button}}
{{#bs-button}}3{{/bs-button}}
{{/bs-button-group}}
Radio-like behaviour
Use the type
property set to "radio" to make the child buttons toggle like radio buttons, i.e. only one button can be active.
Set the value
property of the buttons to something meaningful. The value
property of the button group will then reflect
the value of the active button:
{{#bs-button-group value=buttonGroupValue type="radio"}}
{{#bs-button value='foo'}}foo{{/bs-button}}
{{#bs-button value='bar'}}bar{{/bs-button}}
{{#bs-button value='baz'}}baz{{/bs-button}}
{{/bs-button-group}}
You selected: {{buttonGroupValue}}!
Checkbox-like behaviour
Set type
to "checkbox" to make any number of child buttons selectable. The value
property will be an array
of all the values of the active buttons:
{{#bs-button-group value=buttonGroupValue type="checkbox"}}
{{#bs-button value='foo'}}foo{{/bs-button}}
{{#bs-button value='bar'}}bar{{/bs-button}}
{{#bs-button value='baz'}}baz{{/bs-button}}
{{/bs-button-group}}
You selected:
<ul>
{{#each value in buttonGroupValue}}
<li>{{value}}</li>
{{/each}}
</ul>
Item Index
Properties
activeChildren array
protectedChild buttons that are active (pressed)
ariaRole string
protectedDefault: 'group'
classNameBindings array
protectedclassNames array
protectedDefault: ['btn-group']
classTypePrefix String
protectedDefault: 'btn-group'
justified boolean
publicSet to true for the buttons to stretch at equal sizes to span the entire width of its parent.
Important: You have to wrap every button component in a div class="btn-group">
:
<div class="btn-group" role="group">
{{#bs-button}}My Button{{/bs-button}}
</div>
See http://getbootstrap.com/components/#btn-groups-justified
Default: false
size String
publictype string
publicThe type of the button group specifies how child buttons behave and how the value
property will be computed:
null
If type
is not set (null), the button group will add no functionality besides Bootstrap styling
radio
if type
is set to "radio", the buttons will behave like radio buttons:
- the buttons will toggle (
toggle
property of the child buttons will be set to true) - only one button may be active
- the
value
property of the button group will reflect thevalue
property of the active button
checkbox
if type
is set to "checkbox", the buttons will behave like checkboxes:
- the buttons will toggle (
toggle
property of the child buttons will be set to true) - any number of buttons may be active
- the
value
property of the button group will be an array containing thevalue
properties of all active buttons
Default: null
value array
publicThe value of the button group, computed by its child buttons.
See the type
property for how the value property is constructed.
When you set the value, the corresponding buttons will be activated:
- use a single value for a radio button group to activate the button with the same value
- use an array of values for a checkbox button group to activate all the buttons with values contained in the array
vertical boolean
publicSet to true for a vertically stacked button group, see http://getbootstrap.com/components/#btn-groups-vertical
Default: false