Skip to content

Commit 0a4d315

Browse files
committed
Fixes #18573: Change name of .form-control-label to .col-form-label (and .form-control-legend to .col-form-legend) to reiterate use for only grid layouts
1 parent fd26096 commit 0a4d315

File tree

2 files changed

+29
-29
lines changed

2 files changed

+29
-29
lines changed

docs/components/forms.md

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -172,79 +172,79 @@ Here are examples of `.form-control` applied to each textual HTML5 `<input>` `ty
172172

173173
{% example html %}
174174
<div class="form-group row">
175-
<label for="example-text-input" class="col-xs-2 form-control-label">Text</label>
175+
<label for="example-text-input" class="col-xs-2 col-form-label">Text</label>
176176
<div class="col-xs-10">
177177
<input class="form-control" type="text" value="Artisanal kale" id="example-text-input">
178178
</div>
179179
</div>
180180
<div class="form-group row">
181-
<label for="example-search-input" class="col-xs-2 form-control-label">Search</label>
181+
<label for="example-search-input" class="col-xs-2 col-form-label">Search</label>
182182
<div class="col-xs-10">
183183
<input class="form-control" type="search" value="How do I shoot web" id="example-search-input">
184184
</div>
185185
</div>
186186
<div class="form-group row">
187-
<label for="example-email-input" class="col-xs-2 form-control-label">Email</label>
187+
<label for="example-email-input" class="col-xs-2 col-form-label">Email</label>
188188
<div class="col-xs-10">
189189
<input class="form-control" type="email" value="[email protected]" id="example-email-input">
190190
</div>
191191
</div>
192192
<div class="form-group row">
193-
<label for="example-url-input" class="col-xs-2 form-control-label">URL</label>
193+
<label for="example-url-input" class="col-xs-2 col-form-label">URL</label>
194194
<div class="col-xs-10">
195195
<input class="form-control" type="url" value="http://getbootstrap.com" id="example-url-input">
196196
</div>
197197
</div>
198198
<div class="form-group row">
199-
<label for="example-tel-input" class="col-xs-2 form-control-label">Telephone</label>
199+
<label for="example-tel-input" class="col-xs-2 col-form-label">Telephone</label>
200200
<div class="col-xs-10">
201201
<input class="form-control" type="tel" value="1-(555)-555-5555" id="example-tel-input">
202202
</div>
203203
</div>
204204
<div class="form-group row">
205-
<label for="example-password-input" class="col-xs-2 form-control-label">Password</label>
205+
<label for="example-password-input" class="col-xs-2 col-form-label">Password</label>
206206
<div class="col-xs-10">
207207
<input class="form-control" type="password" value="hunter2" id="example-password-input">
208208
</div>
209209
</div>
210210
<div class="form-group row">
211-
<label for="example-number-input" class="col-xs-2 form-control-label">Number</label>
211+
<label for="example-number-input" class="col-xs-2 col-form-label">Number</label>
212212
<div class="col-xs-10">
213213
<input class="form-control" type="number" value="42" id="example-number-input">
214214
</div>
215215
</div>
216216
<div class="form-group row">
217-
<label for="example-datetime-local-input" class="col-xs-2 form-control-label">Date and time</label>
217+
<label for="example-datetime-local-input" class="col-xs-2 col-form-label">Date and time</label>
218218
<div class="col-xs-10">
219219
<input class="form-control" type="datetime-local" value="2011-08-19T13:45:00" id="example-datetime-local-input">
220220
</div>
221221
</div>
222222
<div class="form-group row">
223-
<label for="example-date-input" class="col-xs-2 form-control-label">Date</label>
223+
<label for="example-date-input" class="col-xs-2 col-form-label">Date</label>
224224
<div class="col-xs-10">
225225
<input class="form-control" type="date" value="2011-08-19" id="example-date-input">
226226
</div>
227227
</div>
228228
<div class="form-group row">
229-
<label for="example-month-input" class="col-xs-2 form-control-label">Month</label>
229+
<label for="example-month-input" class="col-xs-2 col-form-label">Month</label>
230230
<div class="col-xs-10">
231231
<input class="form-control" type="month" value="2011-08" id="example-month-input">
232232
</div>
233233
</div>
234234
<div class="form-group row">
235-
<label for="example-week-input" class="col-xs-2 form-control-label">Week</label>
235+
<label for="example-week-input" class="col-xs-2 col-form-label">Week</label>
236236
<div class="col-xs-10">
237237
<input class="form-control" type="week" value="2011-W33" id="example-week-input">
238238
</div>
239239
</div>
240240
<div class="form-group row">
241-
<label for="example-time-input" class="col-xs-2 form-control-label">Time</label>
241+
<label for="example-time-input" class="col-xs-2 col-form-label">Time</label>
242242
<div class="col-xs-10">
243243
<input class="form-control" type="time" value="13:45:00" id="example-time-input">
244244
</div>
245245
</div>
246246
<div class="form-group row">
247-
<label for="example-color-input" class="col-xs-2 form-control-label">Color</label>
247+
<label for="example-color-input" class="col-xs-2 col-form-label">Color</label>
248248
<div class="col-xs-10">
249249
<input class="form-control" type="color" value="#563d7c" id="example-color-input">
250250
</div>
@@ -342,25 +342,25 @@ Because of this, you may need to manually address the width and alignment of ind
342342

343343
For more structured form layouts that are also responsive, you can utilize Bootstrap's [predefined grid classes](/layout/grid/#predefined-classes) or [mixins](/layout/grid/#sass-mixins) to create horizontal forms. Add the `.row` class to form groups and use the `.col-*-*` classes to specify the width of your labels and controls.
344344

345-
Be sure to add `.form-control-label` to your `<label>`s as well so they're vertically centered with their associated form controls. For `<legend>` elements, you can use `.form-control-legend` to make them appear similar to regular `<label>` elements.
345+
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.
346346

347347
{% example html %}
348348
<div class="container">
349349
<form>
350350
<div class="form-group row">
351-
<label for="inputEmail3" class="col-sm-2 form-control-label">Email</label>
351+
<label for="inputEmail3" class="col-sm-2 col-form-label">Email</label>
352352
<div class="col-sm-10">
353353
<input type="email" class="form-control" id="inputEmail3" placeholder="Email">
354354
</div>
355355
</div>
356356
<div class="form-group row">
357-
<label for="inputPassword3" class="col-sm-2 form-control-label">Password</label>
357+
<label for="inputPassword3" class="col-sm-2 col-form-label">Password</label>
358358
<div class="col-sm-10">
359359
<input type="password" class="form-control" id="inputPassword3" placeholder="Password">
360360
</div>
361361
</div>
362362
<fieldset class="form-group row">
363-
<legend class="form-control-legend col-sm-2">Radios</legend>
363+
<legend class="col-form-legend col-sm-2">Radios</legend>
364364
<div class="col-sm-10">
365365
<div class="radio">
366366
<label>
@@ -407,13 +407,13 @@ Grid-based form layouts also support large and small inputs.
407407
<div class="container">
408408
<form>
409409
<div class="form-group row">
410-
<label for="lgFormGroupInput" class="col-sm-2 form-control-label form-control-label-lg">Email</label>
410+
<label for="lgFormGroupInput" class="col-sm-2 col-form-label col-form-label-lg">Email</label>
411411
<div class="col-sm-10">
412412
<input type="email" class="form-control form-control-lg" id="lgFormGroupInput" placeholder="[email protected]">
413413
</div>
414414
</div>
415415
<div class="form-group row">
416-
<label for="smFormGroupInput" class="col-sm-2 form-control-label form-control-label-sm">Email</label>
416+
<label for="smFormGroupInput" class="col-sm-2 col-form-label col-form-label-sm">Email</label>
417417
<div class="col-sm-10">
418418
<input type="email" class="form-control form-control-sm" id="smFormGroupInput" placeholder="[email protected]">
419419
</div>
@@ -517,13 +517,13 @@ When you need to place plain text next to a form label within a form, use the `.
517517
{% example html %}
518518
<form>
519519
<div class="form-group row">
520-
<label class="col-sm-2 form-control-label">Email</label>
520+
<label class="col-sm-2 col-form-label">Email</label>
521521
<div class="col-sm-10">
522522
<p class="form-control-static">[email protected]</p>
523523
</div>
524524
</div>
525525
<div class="form-group row">
526-
<label for="inputPassword" class="col-sm-2 form-control-label">Password</label>
526+
<label for="inputPassword" class="col-sm-2 col-form-label">Password</label>
527527
<div class="col-sm-10">
528528
<input type="password" class="form-control" id="inputPassword" placeholder="Password">
529529
</div>
@@ -670,7 +670,7 @@ Block help text—for below inputs or for longer lines of help text—can be eas
670670

671671
Bootstrap includes validation styles for danger, warning, and success states on form controls. Here's a rundown of how they work:
672672

673-
- To use, add `.has-warning`, `.has-danger`, or `.has-success` to the parent element. Any `.form-control-label`, `.form-control`, or custom form element will receive the validation styles.
673+
- To use, add `.has-warning`, `.has-danger`, or `.has-success` to the parent element. Any `.col-form-label`, `.form-control`, or custom form element will receive the validation styles.
674674
- Contextual validation text, in addition to your usual form field help text, can be added with the use of `.form-control-feedback`. This text will adapt to the parent `.has-*` class. By default it only includes a bit of `margin` for spacing and a modified `color` for each state.
675675
- Validation icons are `url()`s configured via Sass variables that are applied to `background-image` declarations for each state.
676676
- You may use your own base64 PNGs or SVGs by updating the Sass variables and recompiling.
@@ -696,19 +696,19 @@ Ensure that an alternative indication of state is also provided. For instance, y
696696

697697
{% example html %}
698698
<div class="form-group has-success">
699-
<label class="form-control-label" for="inputSuccess1">Input with success</label>
699+
<label class="col-form-label" for="inputSuccess1">Input with success</label>
700700
<input type="text" class="form-control form-control-success" id="inputSuccess1">
701701
<div class="form-control-feedback">Success! You've done it.</div>
702702
<small class="text-muted">Example help text that remains unchanged.</small>
703703
</div>
704704
<div class="form-group has-warning">
705-
<label class="form-control-label" for="inputWarning1">Input with warning</label>
705+
<label class="col-form-label" for="inputWarning1">Input with warning</label>
706706
<input type="text" class="form-control form-control-warning" id="inputWarning1">
707707
<div class="form-control-feedback">Shucks, check the formatting of that and try again.</div>
708708
<small class="text-muted">Example help text that remains unchanged.</small>
709709
</div>
710710
<div class="form-group has-danger">
711-
<label class="form-control-label" for="inputDanger1">Input with danger</label>
711+
<label class="col-form-label" for="inputDanger1">Input with danger</label>
712712
<input type="text" class="form-control form-control-danger" id="inputDanger1">
713713
<div class="form-control-feedback">Shit, that username's taken. Try another?</div>
714714
<small class="text-muted">Example help text that remains unchanged.</small>

scss/_forms.scss

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,19 +75,19 @@ select.form-control {
7575

7676
// For use with horizontal and inline forms, when you need the label text to
7777
// align with the form controls.
78-
.form-control-label {
78+
.col-form-label {
7979
padding-top: $input-padding-y;
8080
padding-bottom: $input-padding-y;
8181
margin-bottom: 0; // Override the `<label>` default
8282
}
8383

84-
.form-control-label-lg {
84+
.col-form-label-lg {
8585
padding-top: $input-padding-y-lg;
8686
padding-bottom: $input-padding-y-lg;
8787
font-size: $font-size-lg;
8888
}
8989

90-
.form-control-label-sm {
90+
.col-form-label-sm {
9191
padding-top: $input-padding-y-sm;
9292
padding-bottom: $input-padding-y-sm;
9393
font-size: $font-size-sm;
@@ -100,7 +100,7 @@ select.form-control {
100100

101101
// For use with horizontal and inline forms, when you need the legend text to
102102
// be the same size as regular labels, and to align with the form controls.
103-
.form-control-legend {
103+
.col-form-legend {
104104
padding-top: $input-padding-y;
105105
padding-bottom: $input-padding-y;
106106
margin-bottom: 0;

0 commit comments

Comments
 (0)