1 // stylelint-disable selector-no-qualifying-type
4 // Textual form controls
10 height: $input-height;
11 padding: $input-padding-y $input-padding-x;
12 font-family: $input-font-family;
13 @include font-size($input-font-size);
14 font-weight: $input-font-weight;
15 line-height: $input-line-height;
17 background-color: $input-bg;
18 background-clip: padding-box;
19 border: $input-border-width solid $input-border-color;
21 // Note: This has no effect on <select>s in some browsers, due to the limited stylability of `<select>`s in CSS.
22 @include border-radius($input-border-radius, 0);
24 @include box-shadow($input-box-shadow);
25 @include transition($input-transition);
27 // Unstyle the caret on `<select>`s in IE10+.
29 background-color: transparent;
33 // Customize the `:focus` state to imitate native WebKit styles.
34 @include form-control-focus($ignore-warning: true);
38 color: $input-placeholder-color;
39 // Override Firefox's unusual default opacity; see https://github.com/twbs/bootstrap/pull/11526.
43 // Disabled and read-only inputs
45 // HTML5 says that controls under a fieldset > legend:first-child won't be
46 // disabled if the fieldset is disabled. Due to implementation difficulty, we
47 // don't honor that edge case; we style them as disabled anyway.
50 background-color: $input-disabled-bg;
51 // iOS fix for unreadable disabled content; see https://github.com/twbs/bootstrap/issues/11655.
58 input[type="datetime-local"],
61 appearance: none; // Fix appearance for date inputs in Safari
66 // Remove select outline from select box in FF
69 text-shadow: 0 0 0 $input-color;
73 // Suppress the nested default white text on blue background highlight given to
74 // the selected option text when the (still closed) <select> receives focus
75 // in IE and (under certain conditions) Edge, as it looks bad and cannot be made to
76 // match the appearance of the native widget.
77 // See https://github.com/twbs/bootstrap/issues/19398.
79 background-color: $input-bg;
83 // Make file inputs better match text inputs by forcing them to new lines.
97 font-weight: $label-font-weight;
100 // For use with horizontal and inline forms, when you need the label (or legend)
101 // text to align with the form controls.
103 padding-top: add($input-padding-y, $input-border-width);
104 padding-bottom: add($input-padding-y, $input-border-width);
105 margin-bottom: 0; // Override the `<label>/<legend>` default
106 @include font-size(inherit); // Override the `<legend>` default
107 line-height: $input-line-height;
111 padding-top: add($input-padding-y-lg, $input-border-width);
112 padding-bottom: add($input-padding-y-lg, $input-border-width);
113 @include font-size($input-font-size-lg);
114 line-height: $input-line-height-lg;
118 padding-top: add($input-padding-y-sm, $input-border-width);
119 padding-bottom: add($input-padding-y-sm, $input-border-width);
120 @include font-size($input-font-size-sm);
121 line-height: $input-line-height-sm;
125 // Readonly controls as plain text
127 // Apply class to a readonly input to make it appear like regular plain
128 // text (without any border, background color, focus indicator)
130 .form-control-plaintext {
133 padding: $input-padding-y 0;
134 margin-bottom: 0; // match inputs if this class comes on inputs with default margins
135 @include font-size($input-font-size);
136 line-height: $input-line-height;
137 color: $input-plaintext-color;
138 background-color: transparent;
139 border: solid transparent;
140 border-width: $input-border-width 0;
150 // Form control sizing
152 // Build on `.form-control` with modifier classes to decrease or increase the
153 // height and font-size of form controls.
155 // Repeated in `_input_group.scss` to avoid Sass extend issues.
158 height: $input-height-sm;
159 padding: $input-padding-y-sm $input-padding-x-sm;
160 @include font-size($input-font-size-sm);
161 line-height: $input-line-height-sm;
162 @include border-radius($input-border-radius-sm);
166 height: $input-height-lg;
167 padding: $input-padding-y-lg $input-padding-x-lg;
168 @include font-size($input-font-size-lg);
169 line-height: $input-line-height-lg;
170 @include border-radius($input-border-radius-lg);
173 // stylelint-disable-next-line no-duplicate-selectors
174 select.form-control {
181 textarea.form-control {
187 // Designed to help with the organization and spacing of vertical forms. For
188 // horizontal forms, use the predefined grid classes.
191 margin-bottom: $form-group-margin-bottom;
196 margin-top: $form-text-margin-top;
202 // Special replacement for our grid system's `.row` for tighter form layouts.
207 margin-right: -$form-grid-gutter-width * .5;
208 margin-left: -$form-grid-gutter-width * .5;
212 padding-right: $form-grid-gutter-width * .5;
213 padding-left: $form-grid-gutter-width * .5;
218 // Checkboxes and radios
220 // Indent the labels to position radios/checkboxes as hanging controls.
225 padding-left: $form-check-input-gutter;
230 margin-top: $form-check-input-margin-y;
231 margin-left: -$form-check-input-gutter;
233 // Use [disabled] and :disabled for workaround https://github.com/twbs/bootstrap/issues/28247
234 &[disabled] ~ .form-check-label,
235 &:disabled ~ .form-check-label {
241 font-weight: $label-font-weight; // Nick
242 margin-bottom: 0; // Override default `<label>` bottom margin
246 display: inline-flex;
248 padding-left: 0; // Override base .form-check
249 margin-right: $form-check-inline-margin-x;
251 // Undo .form-check-input defaults and add some `margin-right`.
255 margin-right: $form-check-inline-input-margin-x;
263 // Provide feedback to users when form field values are valid or invalid. Works
264 // primarily for client-side validation via scoped `:invalid` and `:valid`
265 // pseudo-classes but also includes `.is-invalid` and `.is-valid` classes for
266 // server side validation.
268 @each $state, $data in $form-validation-states {
269 @include form-validation-state($state, map-get($data, color), map-get($data, icon));
274 // Make forms appear inline(-block) by adding the `.form-inline` class. Inline
275 // forms begin stacked on extra small (mobile) devices and then go inline when
276 // viewports reach <768px.
278 // Requires wrapping inputs and labels with `.form-group` for proper display of
279 // default HTML form controls and our custom form controls (e.g., input groups).
284 align-items: center; // Prevent shorter elements from growing to same height as others (e.g., small buttons growing to normal sized button height)
286 // Because we use flex, the initial sizing of checkboxes is collapsed and
287 // doesn't occupy the full-width (which is what we want for xs grid tier),
288 // so we force that here.
293 // Kick in the inline
294 @include media-breakpoint-up(sm) {
298 justify-content: center;
302 // Inline-block all the things for "inline"
311 // Allow folks to *not* use `.form-group`
313 display: inline-block;
314 width: auto; // Prevent labels from stacking above inputs in `.form-group`
315 vertical-align: middle;
318 // Make static controls behave like regular ones
319 .form-control-plaintext {
320 display: inline-block;
328 // Remove default margin on radios/checkboxes that were used for stacking, and
329 // then undo the floating of radios and checkboxes to match.
333 justify-content: center;
341 margin-right: $form-check-input-margin-x;
347 justify-content: center;
349 .custom-control-label {