Example 1: bootstrap 4 button
<button type="button" class="btn btn-primary">Primary</button> <button type="button" class="btn btn-secondary">Secondary</button> <button type="button" class="btn btn-success">Success</button> <button type="button" class="btn btn-danger">Danger</button> <button type="button" class="btn btn-warning">Warning</button> <button type="button" class="btn btn-info">Info</button> <button type="button" class="btn btn-light">Light</button> <button type="button" class="btn btn-dark">Dark</button> <button type="button" class="btn btn-link">Link</button>
Example 2: bootstrap buttons Toggle states
Add data-toggle="button" to toggle a button’s active state. If you’re pre-toggling a button, you must manually add the .active class and aria-pressed="true" to the <button>. <button type="button" class="btn btn-primary" data-toggle="button" aria-pressed="false"> Single toggle </button>
Example 3: bootstrap Checkbox buttons
Bootstrap’s .button styles can be applied to other elements, such as <label>s, to provide checkbox or radio style button toggling. Add data-toggle="buttons" to a .btn-group containing those modified buttons to enable their toggling behavior via JavaScript and add .btn-group-toggle to style the <input>s within your buttons. Note that you can create single input-powered buttons or groups of them. The checked state for these buttons is only updated via click event on the button. If you use another method to update the input—e.g., with <input type="reset"> or by manually applying the input’s checked property—you’ll need to toggle .active on the <label> manually. Note that pre-checked buttons require you to manually add the .active class to the input’s <label>. <div class="btn-group btn-group-toggle" data-toggle="buttons"> <label class="btn btn-secondary active"> <input type="radio" name="options" id="option1" checked> Active </label> <label class="btn btn-secondary"> <input type="radio" name="options" id="option2"> Radio </label> <label class="btn btn-secondary"> <input type="radio" name="options" id="option3"> Radio </label> </div>
Comments
Post a Comment