<div id="buttonGroup1"></div>
<br>
<div id="buttonGroup2"></div>
buttonGroup = new hx.ButtonGroup('#buttonGroup1')
buttonGroup.items(['Option 1', 'Option 2', 'Option 3', 'Option 4', 'Other']);
// Full width example with individual active classes per-button
buttonGroup = new hx.ButtonGroup('#buttonGroup2', {fullWidth: true})
buttonGroup.items([
{
value: 'Positive',
activeClass: 'hx-positive'
}, {
value: 'Warning',
activeClass: 'hx-warning'
}, {
value: 'Negative',
activeClass: 'hx-negative'
}, {
value: 'Info',
activeClass: 'hx-info'
},
'Other'
]);
buttonGroup.value('Positive');
[
'Button Text', // Strings and objects can be mixed if required
{
value: 'Button Text' // If objects are used, the value property is required
},
{
value: 'Button Text',
activeClass: 'hx-positive' // The activeClass property is optional.
}
]
function(node, data, current) {
hx.select(node).text(data.value != null ? data.value : data);
};
[
'Button Text', // Strings and objects can be mixed if required
{
value: 'Button Text' // If objects are used, the value property is required
},
{
value: 'Button Text',
activeClass: 'hx-positive' // The activeClass property is optional.
}
]
function(node, data, current) {
hx.select(node).text(data.value != null ? data.value : data);
};
[
'Button Text', // Strings and objects can be mixed if required
{
value: 'Button Text' // If objects are used, the value property is required
},
{
value: 'Button Text',
activeClass: 'hx-positive' // The activeClass property is optional.
}
]
function(node, data, current) {
hx.select(node).text(data.value != null ? data.value : data);
};