1 // scss-lint:disable QualifyingElement
4 // Textual form controls
10 // // Make inputs at least the height of their button counterpart (base line-height + padding + border)
11 // height: $input-height;
12 padding: $input-padding-y $input-padding-x;
13 font-size: $font-size-base;
14 line-height: $input-line-height;
16 background-color: $input-bg;
17 // Reset unusual Firefox-on-Android default style; see https://github.com/necolas/normalize.css/issues/214.
18 background-image: none;
19 background-clip: padding-box;
20 border: $input-btn-border-width solid $input-border-color;
22 // Note: This has no effect on <select>s in some browsers, due to the limited stylability of `<select>`s in CSS.
24 // Manually use the if/else instead of the mixin to account for iOS override
25 border-radius: $input-border-radius;
27 // Otherwise undo the iOS default
31 @include box-shadow($input-box-shadow);
32 @include transition($input-transition);
34 // Unstyle the caret on `<select>`s in IE10+.
36 background-color: transparent;
40 // Customize the `:focus` state to imitate native WebKit styles.
41 @include form-control-focus();
45 color: $input-color-placeholder;
46 // Override Firefox's unusual default opacity; see https://github.com/twbs/bootstrap/pull/11526.
50 // Disabled and read-only inputs
52 // HTML5 says that controls under a fieldset > legend:first-child won't be
53 // disabled if the fieldset is disabled. Due to implementation difficulty, we
54 // don't honor that edge case; we style them as disabled anyway.
57 background-color: $input-bg-disabled;
58 // iOS fix for unreadable disabled content; see https://github.com/twbs/bootstrap/issues/11655.
63 cursor: $cursor-disabled;
68 &:not([size]):not([multiple]) {
69 $select-border-width: ($border-width * 2);
70 height: calc(#{$input-height} + #{$select-border-width});
74 // Suppress the nested default white text on blue background highlight given to
75 // the selected option text when the (still closed) <select> receives focus
76 // in IE and (under certain conditions) Edge, as it looks bad and cannot be made to
77 // match the appearance of the native widget.
78 // See https://github.com/twbs/bootstrap/issues/19398.
80 background-color: $input-bg;
84 // Make file inputs better match text inputs by forcing them to new lines.
95 // For use with horizontal and inline forms, when you need the label text to
96 // align with the form controls.
98 padding-top: calc(#{$input-padding-y} - #{$input-btn-border-width} * 2);
99 padding-bottom: calc(#{$input-padding-y} - #{$input-btn-border-width} * 2);
100 margin-bottom: 0; // Override the `<label>` default
104 padding-top: calc(#{$input-padding-y-lg} - #{$input-btn-border-width} * 2);
105 padding-bottom: calc(#{$input-padding-y-lg} - #{$input-btn-border-width} * 2);
106 font-size: $font-size-lg;
110 padding-top: calc(#{$input-padding-y-sm} - #{$input-btn-border-width} * 2);
111 padding-bottom: calc(#{$input-padding-y-sm} - #{$input-btn-border-width} * 2);
112 font-size: $font-size-sm;
120 // For use with horizontal and inline forms, when you need the legend text to
121 // be the same size as regular labels, and to align with the form controls.
123 padding-top: $input-padding-y;
124 padding-bottom: $input-padding-y;
126 font-size: $font-size-base;
130 // Static form control text
132 // Apply class to an element to make any string of text align with labels in a
133 // horizontal form layout.
135 .form-control-static {
136 padding-top: $input-padding-y;
137 padding-bottom: $input-padding-y;
138 margin-bottom: 0; // match inputs if this class comes on inputs with default margins
139 line-height: $input-line-height;
140 border: solid transparent;
141 border-width: $input-btn-border-width 0;
151 // Form control sizing
153 // Build on `.form-control` with modifier classes to decrease or increase the
154 // height and font-size of form controls.
156 // The `.form-group-* form-control` variations are sadly duplicated to avoid the
157 // issue documented in https://github.com/twbs/bootstrap/issues/15074.
160 padding: $input-padding-y-sm $input-padding-x-sm;
161 font-size: $font-size-sm;
162 @include border-radius($input-border-radius-sm);
165 select.form-control-sm {
166 &:not([size]):not([multiple]) {
167 height: $input-height-sm;
172 padding: $input-padding-y-lg $input-padding-x-lg;
173 font-size: $font-size-lg;
174 @include border-radius($input-border-radius-lg);
177 select.form-control-lg {
178 &:not([size]):not([multiple]) {
179 height: $input-height-lg;
186 // Designed to help with the organization and spacing of vertical forms. For
187 // horizontal forms, use the predefined grid classes.
190 margin-bottom: $form-group-margin-bottom;
195 margin-top: $form-text-margin-top;
199 // Checkboxes and radios
201 // Indent the labels to position radios/checkboxes as hanging controls.
206 margin-bottom: $form-check-margin-bottom;
211 cursor: $cursor-disabled;
217 padding-left: $form-check-input-gutter;
218 margin-bottom: 0; // Override default `<label>` bottom margin
224 margin-top: $form-check-input-margin-y;
225 margin-left: -$form-check-input-gutter;
232 // Radios and checkboxes on same line
234 display: inline-block;
237 vertical-align: middle;
240 + .form-check-inline {
241 margin-left: $form-check-inline-margin-x;
246 // Form control feedback states
248 // Apply contextual and semantic states to individual form controls.
250 .form-control-feedback {
251 margin-top: $form-feedback-margin-top;
254 .form-control-success,
255 .form-control-warning,
256 .form-control-danger {
257 padding-right: ($input-padding-x * 3);
258 background-repeat: no-repeat;
259 background-position: center right ($input-height / 4);
260 background-size: ($input-height / 2) ($input-height / 2);
263 // Form validation states
265 @include form-control-validation($brand-success);
267 .form-control-success {
268 background-image: $form-icon-success;
273 @include form-control-validation($brand-warning);
275 .form-control-warning {
276 background-image: $form-icon-warning;
281 @include form-control-validation($brand-danger);
283 .form-control-danger {
284 background-image: $form-icon-danger;
291 // Make forms appear inline(-block) by adding the `.form-inline` class. Inline
292 // forms begin stacked on extra small (mobile) devices and then go inline when
293 // viewports reach <768px.
295 // Requires wrapping inputs and labels with `.form-group` for proper display of
296 // default HTML form controls and our custom form controls (e.g., input groups).
301 align-items: center; // Prevent shorter elements from growing to same height as others (e.g., small buttons growing to normal sized button height)
303 // Because we use flex, the initial sizing of checkboxes is collapsed and
304 // doesn't occupy the full-width (which is what we want for xs grid tier),
305 // so we force that here.
310 // Kick in the inline
311 @include media-breakpoint-up(sm) {
315 justify-content: center;
319 // Inline-block all the things for "inline"
328 // Allow folks to *not* use `.form-group`
330 display: inline-block;
331 width: auto; // Prevent labels from stacking above inputs in `.form-group`
332 vertical-align: middle;
335 // Make static controls behave like regular ones
336 .form-control-static {
337 display: inline-block;
344 .form-control-label {
346 vertical-align: middle;
349 // Remove default margin on radios/checkboxes that were used for stacking, and
350 // then undo the floating of radios and checkboxes to match.
354 justify-content: center;
365 margin-right: $form-check-input-margin-x;
369 // Custom form controls
373 justify-content: center;
376 .custom-control-indicator {
378 display: inline-block;
379 margin-right: $form-check-input-margin-x; // Flexbox alignment means we lose our HTML space here, so we compensate.
380 vertical-align: text-bottom;
383 // Re-override the feedback icon.
384 .has-feedback .form-control-feedback {