bootstrap radio buttons code example
Example 1: bootstrap radio
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="inlineRadioOptions" id="inlineRadio1" value="option1">
<label class="form-check-label" for="inlineRadio1">1</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="inlineRadioOptions" id="inlineRadio2" value="option2">
<label class="form-check-label" for="inlineRadio2">2</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="inlineRadioOptions" id="inlineRadio3" value="option3" disabled>
<label class="form-check-label" for="inlineRadio3">3 (disabled)</label>
</div>
Example 2: bootstrap radio button
<div class="form-check">
<input class="form-check-input" type="radio" name="exampleRadios" id="exampleRadios1" value="option1" checked>
<label class="form-check-label" for="exampleRadios1">
Default radio
</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="exampleRadios" id="exampleRadios2" value="option2">
<label class="form-check-label" for="exampleRadios2">
Second default radio
</label>
</div>
<div class="form-check disabled">
<input class="form-check-input" type="radio" name="exampleRadios" id="exampleRadios3" value="option3" disabled>
<label class="form-check-label" for="exampleRadios3">
Disabled radio
</label>
</div>
Example 3: radio button bootstrap
<div class="btn-group btn-group-toggle" data-toggle="buttons">
<label class="btn btn-secondary active">
<input type="radio" name="options" id="option1" autocomplete="off" checked> Active
</label>
<label class="btn btn-secondary">
<input type="radio" name="options" id="option2" autocomplete="off"> Radio
</label>
<label class="btn btn-secondary">
<input type="radio" name="options" id="option3" autocomplete="off"> Radio
</label>
</div>
Example 4: bootstrap radio 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-toggle" data-toggle="buttons">
<label class="btn btn-secondary active">
<input type="checkbox" checked> Checked
</label>
</div>
Example 5: bootstrap radio button
<input type="radio" class="btn-check" name="options" id="option1" autocomplete="off" checked>
<label class="btn btn-secondary" for="option1">Checked</label>
<input type="radio" class="btn-check" name="options" id="option2" autocomplete="off">
<label class="btn btn-secondary" for="option2">Radio</label>
<input type="radio" class="btn-check" name="options" id="option3" autocomplete="off" disabled>
<label class="btn btn-secondary" for="option3">Disabled</label>
<input type="radio" class="btn-check" name="options" id="option4" autocomplete="off">
<label class="btn btn-secondary" for="option4">Radio</label>
Example 6: 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>