Do more with buttons. Control button states or create groups of buttons for more components like toolbars.
Use the buttons plugin for states and toggles.
| Stateful | |
| Single toggle | |
| Checkbox |
|
| Radio |
|
Enable buttons via javascript:
$('.nav-tabs').button()
Data attributes are integral to the button plugin. Check out the example code below for the various markup types.
<!-- Add data-toggle="button" to activate toggling on a single button --> <button class="btn" data-toggle="button">Single Toggle</button> <!-- Add data-toggle="buttons-checkbox" for checkbox style toggling on btn-group --> <div class="btn-group" data-toggle="buttons-checkbox"> <button class="btn">Left</button> <button class="btn">Middle</button> <button class="btn">Right</button> </div> <!-- Add data-toggle="buttons-radio" for radio style toggling on btn-group --> <div class="btn-group" data-toggle="buttons-radio"> <button class="btn">Left</button> <button class="btn">Middle</button> <button class="btn">Right</button> </div>
Toggles push state. Gives the button the appearance that it has been activated.
data-toggle attribute.
<button class="btn" data-toggle="button" >…</button>
Sets button state to loading - disables button and swaps text to loading text. Loading text should be defined on the button element
using the data attribute data-loading-text.
<button class="btn" data-loading-text="loading stuff..." >...</button>
autocomplete="off".
Resets button state - swaps text to original text.
Resets button state - swaps text to any data defined text state.
<button class="btn" data-complete-text="finished!" >...</button>
<script>
$('.btn').button('complete')
</script>