diff options
Diffstat (limited to 'docs/4.0/components/forms.md')
| -rw-r--r-- | docs/4.0/components/forms.md | 115 |
1 files changed, 70 insertions, 45 deletions
diff --git a/docs/4.0/components/forms.md b/docs/4.0/components/forms.md index ba5633850..84891d841 100644 --- a/docs/4.0/components/forms.md +++ b/docs/4.0/components/forms.md @@ -365,62 +365,87 @@ Create horizontal forms with the grid by adding the `.row` class to form groups Be sure to add `.col-form-label` to your `<label>`s as well so they're vertically centered with their associated form controls. For `<legend>` elements, you can use `.col-form-legend` to make them appear similar to regular `<label>` elements. {% example html %} -<div class="container"> - <form> - <div class="form-group row"> - <label for="inputEmail3" class="col-sm-2 col-form-label">Email</label> - <div class="col-sm-10"> - <input type="email" class="form-control" id="inputEmail3" placeholder="Email"> - </div> +<form> + <div class="form-group row"> + <label for="inputEmail3" class="col-sm-2 col-form-label">Email</label> + <div class="col-sm-10"> + <input type="email" class="form-control" id="inputEmail3" placeholder="Email"> </div> - <div class="form-group row"> - <label for="inputPassword3" class="col-sm-2 col-form-label">Password</label> - <div class="col-sm-10"> - <input type="password" class="form-control" id="inputPassword3" placeholder="Password"> - </div> + </div> + <div class="form-group row"> + <label for="inputPassword3" class="col-sm-2 col-form-label">Password</label> + <div class="col-sm-10"> + <input type="password" class="form-control" id="inputPassword3" placeholder="Password"> </div> - <fieldset class="form-group"> - <div class="row"> - <legend class="col-form-legend col-sm-2">Radios</legend> - <div class="col-sm-10"> - <div class="form-check"> - <label class="form-check-label"> - <input class="form-check-input" type="radio" name="gridRadios" id="gridRadios1" value="option1" checked> - Option one is this and that—be sure to include why it's great - </label> - </div> - <div class="form-check"> - <label class="form-check-label"> - <input class="form-check-input" type="radio" name="gridRadios" id="gridRadios2" value="option2"> - Option two can be something else and selecting it will deselect option one - </label> - </div> - <div class="form-check disabled"> - <label class="form-check-label"> - <input class="form-check-input" type="radio" name="gridRadios" id="gridRadios3" value="option3" disabled> - Option three is disabled - </label> - </div> - </div> - </div> - </fieldset> - <div class="form-group row"> - <div class="col-sm-2">Checkbox</div> + </div> + <fieldset class="form-group"> + <div class="row"> + <legend class="col-form-legend col-sm-2">Radios</legend> <div class="col-sm-10"> <div class="form-check"> <label class="form-check-label"> - <input class="form-check-input" type="checkbox"> Check me out + <input class="form-check-input" type="radio" name="gridRadios" id="gridRadios1" value="option1" checked> + Option one is this and that—be sure to include why it's great + </label> + </div> + <div class="form-check"> + <label class="form-check-label"> + <input class="form-check-input" type="radio" name="gridRadios" id="gridRadios2" value="option2"> + Option two can be something else and selecting it will deselect option one + </label> + </div> + <div class="form-check disabled"> + <label class="form-check-label"> + <input class="form-check-input" type="radio" name="gridRadios" id="gridRadios3" value="option3" disabled> + Option three is disabled </label> </div> </div> </div> - <div class="form-group row"> - <div class="col-sm-10"> - <button type="submit" class="btn btn-primary">Sign in</button> + </fieldset> + <div class="form-group row"> + <div class="col-sm-2">Checkbox</div> + <div class="col-sm-10"> + <div class="form-check"> + <label class="form-check-label"> + <input class="form-check-input" type="checkbox"> Check me out + </label> </div> </div> - </form> -</div> + </div> + <div class="form-group row"> + <div class="col-sm-10"> + <button type="submit" class="btn btn-primary">Sign in</button> + </div> + </div> +</form> +{% endexample %} + +##### Horizontal form label sizing + +Be sure to use `.col-form-label-sm` or `.col-form-label-lg` to your `<label>`s to correctly follow the size of `.form-control-lg` and `.form-control-sm`. + +{% example html %} +<form> + <div class="form-group row"> + <label for="colFormLabelSm" class="col-sm-2 col-form-label col-form-label-sm">Email</label> + <div class="col-sm-10"> + <input type="email" class="form-control form-control-sm" id="colFormLabelSm" placeholder="col-form-label-sm"> + </div> + </div> + <div class="form-group row"> + <label for="colFormLabel" class="col-sm-2 col-form-label">Email</label> + <div class="col-sm-10"> + <input type="email" class="form-control" id="colFormLabel" placeholder="col-form-label"> + </div> + </div> + <div class="form-group row"> + <label for="colFormLabelLg" class="col-sm-2 col-form-label col-form-label-lg">Email</label> + <div class="col-sm-10"> + <input type="email" class="form-control form-control-lg" id="colFormLabelLg" placeholder="col-form-label-lg"> + </div> + </div> +</form> {% endexample %} #### Column sizing |
