1 // Embedded icons from Open Iconic.
2 // Released under MIT and copyright 2014 Waybury.
3 // https://useiconic.com/open
6 // Checkboxes and radios
8 // Base class takes care of all the key behavioral aspects.
14 min-height: $font-size-base * $line-height-base;
15 padding-left: $custom-control-gutter + $custom-control-indicator-size;
16 color-adjust: exact; // Keep themed appearance for print
19 .custom-control-inline {
21 margin-right: $custom-control-spacer-x;
24 .custom-control-input {
27 z-index: -1; // Put the input behind the label so it doesn't overlay text
28 width: $custom-control-indicator-size;
29 height: ($font-size-base * $line-height-base + $custom-control-indicator-size) / 2;
32 &:checked ~ .custom-control-label::before {
33 color: $custom-control-indicator-checked-color;
34 border-color: $custom-control-indicator-checked-border-color;
35 @include gradient-bg($custom-control-indicator-checked-bg);
36 @include box-shadow($custom-control-indicator-checked-box-shadow);
39 &:focus ~ .custom-control-label::before {
40 // the mixin is not used here to make sure there is feedback
42 box-shadow: $input-box-shadow, $custom-control-indicator-focus-box-shadow;
44 box-shadow: $custom-control-indicator-focus-box-shadow;
48 &:focus:not(:checked) ~ .custom-control-label::before {
49 border-color: $custom-control-indicator-focus-border-color;
52 &:not(:disabled):active ~ .custom-control-label::before {
53 color: $custom-control-indicator-active-color;
54 background-color: $custom-control-indicator-active-bg;
55 border-color: $custom-control-indicator-active-border-color;
56 @include box-shadow($custom-control-indicator-active-box-shadow);
59 // Use [disabled] and :disabled to work around https://github.com/twbs/bootstrap/issues/28247
62 ~ .custom-control-label {
63 color: $custom-control-label-disabled-color;
66 background-color: $custom-control-indicator-disabled-bg;
72 // Custom control indicators
74 // Build the custom controls out of pseudo-elements.
76 .custom-control-label {
79 color: $custom-control-label-color;
81 cursor: $custom-control-cursor;
83 // Background-color and (when enabled) gradient
86 top: ($font-size-base * $line-height-base - $custom-control-indicator-size) / 2;
87 left: -($custom-control-gutter + $custom-control-indicator-size);
89 width: $custom-control-indicator-size;
90 height: $custom-control-indicator-size;
93 background-color: $custom-control-indicator-bg;
94 border: $custom-control-indicator-border-color solid $custom-control-indicator-border-width;
95 @include box-shadow($custom-control-indicator-box-shadow);
101 top: ($font-size-base * $line-height-base - $custom-control-indicator-size) / 2;
102 left: -($custom-control-gutter + $custom-control-indicator-size);
104 width: $custom-control-indicator-size;
105 height: $custom-control-indicator-size;
107 background: no-repeat 50% / #{$custom-control-indicator-bg-size};
114 // Tweak just a few things for checkboxes.
117 .custom-control-label::before {
118 @include border-radius($custom-checkbox-indicator-border-radius);
121 .custom-control-input:checked ~ .custom-control-label {
123 background-image: escape-svg($custom-checkbox-indicator-icon-checked);
127 .custom-control-input:indeterminate ~ .custom-control-label {
129 border-color: $custom-checkbox-indicator-indeterminate-border-color;
130 @include gradient-bg($custom-checkbox-indicator-indeterminate-bg);
131 @include box-shadow($custom-checkbox-indicator-indeterminate-box-shadow);
134 background-image: escape-svg($custom-checkbox-indicator-icon-indeterminate);
138 .custom-control-input:disabled {
139 &:checked ~ .custom-control-label::before {
140 @include gradient-bg($custom-control-indicator-checked-disabled-bg);
142 &:indeterminate ~ .custom-control-label::before {
143 @include gradient-bg($custom-control-indicator-checked-disabled-bg);
150 // Tweak just a few things for radios.
153 .custom-control-label::before {
154 // stylelint-disable-next-line property-disallowed-list
155 border-radius: $custom-radio-indicator-border-radius;
158 .custom-control-input:checked ~ .custom-control-label {
160 background-image: escape-svg($custom-radio-indicator-icon-checked);
164 .custom-control-input:disabled {
165 &:checked ~ .custom-control-label::before {
166 @include gradient-bg($custom-control-indicator-checked-disabled-bg);
174 // Tweak a few things for switches
177 padding-left: $custom-switch-width + $custom-control-gutter;
179 .custom-control-label {
181 left: -($custom-switch-width + $custom-control-gutter);
182 width: $custom-switch-width;
184 // stylelint-disable-next-line property-disallowed-list
185 border-radius: $custom-switch-indicator-border-radius;
189 top: add(($font-size-base * $line-height-base - $custom-control-indicator-size) / 2, $custom-control-indicator-border-width * 2);
190 left: add(-($custom-switch-width + $custom-control-gutter), $custom-control-indicator-border-width * 2);
191 width: $custom-switch-indicator-size;
192 height: $custom-switch-indicator-size;
193 background-color: $custom-control-indicator-border-color;
194 // stylelint-disable-next-line property-disallowed-list
195 border-radius: $custom-switch-indicator-border-radius;
196 @include transition(transform .15s ease-in-out, $custom-forms-transition);
200 .custom-control-input:checked ~ .custom-control-label {
202 background-color: $custom-control-indicator-bg;
203 transform: translateX($custom-switch-width - $custom-control-indicator-size);
207 .custom-control-input:disabled {
208 &:checked ~ .custom-control-label::before {
209 @include gradient-bg($custom-control-indicator-checked-disabled-bg);
217 // Replaces the browser default select with a custom one, mostly pulled from
218 // https://primer.github.io/.
222 display: inline-block;
224 height: $custom-select-height;
225 padding: $custom-select-padding-y ($custom-select-padding-x + $custom-select-indicator-padding) $custom-select-padding-y $custom-select-padding-x;
226 font-family: $custom-select-font-family;
227 @include font-size($custom-select-font-size);
228 font-weight: $custom-select-font-weight;
229 line-height: $custom-select-line-height;
230 color: $custom-select-color;
231 vertical-align: middle;
232 background: $custom-select-bg $custom-select-background;
233 border: $custom-select-border-width solid $custom-select-border-color;
234 @include border-radius($custom-select-border-radius, 0);
235 @include box-shadow($custom-select-box-shadow);
239 border-color: $custom-select-focus-border-color;
241 @if $enable-shadows {
242 @include box-shadow($custom-select-box-shadow, $custom-select-focus-box-shadow);
244 // Avoid using mixin so we can pass custom focus shadow properly
245 box-shadow: $custom-select-focus-box-shadow;
249 // For visual consistency with other platforms/browsers,
250 // suppress the default white text on blue background highlight given to
251 // the selected option text when the (still closed) <select> receives focus
252 // in IE and (under certain conditions) Edge.
253 // See https://github.com/twbs/bootstrap/issues/19398.
255 background-color: $input-bg;
260 &[size]:not([size="1"]) {
262 padding-right: $custom-select-padding-x;
263 background-image: none;
267 color: $custom-select-disabled-color;
268 background-color: $custom-select-disabled-bg;
271 // Hides the default caret in IE11
276 // Remove outline from select box in FF
279 text-shadow: 0 0 0 $custom-select-color;
284 height: $custom-select-height-sm;
285 padding-top: $custom-select-padding-y-sm;
286 padding-bottom: $custom-select-padding-y-sm;
287 padding-left: $custom-select-padding-x-sm;
288 @include font-size($custom-select-font-size-sm);
292 height: $custom-select-height-lg;
293 padding-top: $custom-select-padding-y-lg;
294 padding-bottom: $custom-select-padding-y-lg;
295 padding-left: $custom-select-padding-x-lg;
296 @include font-size($custom-select-font-size-lg);
302 // Custom file input.
306 display: inline-block;
308 height: $custom-file-height;
316 height: $custom-file-height;
320 &:focus ~ .custom-file-label {
321 border-color: $custom-file-focus-border-color;
322 box-shadow: $custom-file-focus-box-shadow;
325 // Use [disabled] and :disabled to work around https://github.com/twbs/bootstrap/issues/28247
326 &[disabled] ~ .custom-file-label,
327 &:disabled ~ .custom-file-label {
328 background-color: $custom-file-disabled-bg;
331 @each $lang, $value in $custom-file-text {
332 &:lang(#{$lang}) ~ .custom-file-label::after {
337 ~ .custom-file-label[data-browse]::after {
338 content: attr(data-browse);
348 height: $custom-file-height;
349 padding: $custom-file-padding-y $custom-file-padding-x;
350 font-family: $custom-file-font-family;
351 font-weight: $custom-file-font-weight;
352 line-height: $custom-file-line-height;
353 color: $custom-file-color;
354 background-color: $custom-file-bg;
355 border: $custom-file-border-width solid $custom-file-border-color;
356 @include border-radius($custom-file-border-radius);
357 @include box-shadow($custom-file-box-shadow);
366 height: $custom-file-height-inner;
367 padding: $custom-file-padding-y $custom-file-padding-x;
368 line-height: $custom-file-line-height;
369 color: $custom-file-button-color;
371 @include gradient-bg($custom-file-button-bg);
372 border-left: inherit;
373 @include border-radius(0 $custom-file-border-radius $custom-file-border-radius 0);
379 // Style range inputs the same across browsers. Vendor-specific rules for pseudo
380 // elements cannot be mixed. As such, there are no shared styles for focus or
381 // active states on prefixed selectors.
385 height: add($custom-range-thumb-height, $custom-range-thumb-focus-box-shadow-width * 2);
386 padding: 0; // Need to reset padding
387 background-color: transparent;
393 // Pseudo-elements must be split across multiple rulesets to have an effect.
394 // No box-shadow() mixin for focus accessibility.
395 &::-webkit-slider-thumb { box-shadow: $custom-range-thumb-focus-box-shadow; }
396 &::-moz-range-thumb { box-shadow: $custom-range-thumb-focus-box-shadow; }
397 &::-ms-thumb { box-shadow: $custom-range-thumb-focus-box-shadow; }
400 &::-moz-focus-outer {
404 &::-webkit-slider-thumb {
405 width: $custom-range-thumb-width;
406 height: $custom-range-thumb-height;
407 margin-top: ($custom-range-track-height - $custom-range-thumb-height) / 2; // Webkit specific
408 @include gradient-bg($custom-range-thumb-bg);
409 border: $custom-range-thumb-border;
410 @include border-radius($custom-range-thumb-border-radius);
411 @include box-shadow($custom-range-thumb-box-shadow);
412 @include transition($custom-forms-transition);
416 @include gradient-bg($custom-range-thumb-active-bg);
420 &::-webkit-slider-runnable-track {
421 width: $custom-range-track-width;
422 height: $custom-range-track-height;
423 color: transparent; // Why?
424 cursor: $custom-range-track-cursor;
425 background-color: $custom-range-track-bg;
426 border-color: transparent;
427 @include border-radius($custom-range-track-border-radius);
428 @include box-shadow($custom-range-track-box-shadow);
431 &::-moz-range-thumb {
432 width: $custom-range-thumb-width;
433 height: $custom-range-thumb-height;
434 @include gradient-bg($custom-range-thumb-bg);
435 border: $custom-range-thumb-border;
436 @include border-radius($custom-range-thumb-border-radius);
437 @include box-shadow($custom-range-thumb-box-shadow);
438 @include transition($custom-forms-transition);
442 @include gradient-bg($custom-range-thumb-active-bg);
446 &::-moz-range-track {
447 width: $custom-range-track-width;
448 height: $custom-range-track-height;
450 cursor: $custom-range-track-cursor;
451 background-color: $custom-range-track-bg;
452 border-color: transparent; // Firefox specific?
453 @include border-radius($custom-range-track-border-radius);
454 @include box-shadow($custom-range-track-box-shadow);
458 width: $custom-range-thumb-width;
459 height: $custom-range-thumb-height;
460 margin-top: 0; // Edge specific
461 margin-right: $custom-range-thumb-focus-box-shadow-width; // Workaround that overflowed box-shadow is hidden.
462 margin-left: $custom-range-thumb-focus-box-shadow-width; // Workaround that overflowed box-shadow is hidden.
463 @include gradient-bg($custom-range-thumb-bg);
464 border: $custom-range-thumb-border;
465 @include border-radius($custom-range-thumb-border-radius);
466 @include box-shadow($custom-range-thumb-box-shadow);
467 @include transition($custom-forms-transition);
471 @include gradient-bg($custom-range-thumb-active-bg);
476 width: $custom-range-track-width;
477 height: $custom-range-track-height;
479 cursor: $custom-range-track-cursor;
480 background-color: transparent;
481 border-color: transparent;
482 border-width: $custom-range-thumb-height / 2;
483 @include box-shadow($custom-range-track-box-shadow);
487 background-color: $custom-range-track-bg;
488 @include border-radius($custom-range-track-border-radius);
492 margin-right: 15px; // arbitrary?
493 background-color: $custom-range-track-bg;
494 @include border-radius($custom-range-track-border-radius);
498 &::-webkit-slider-thumb {
499 background-color: $custom-range-thumb-disabled-bg;
502 &::-webkit-slider-runnable-track {
506 &::-moz-range-thumb {
507 background-color: $custom-range-thumb-disabled-bg;
510 &::-moz-range-track {
515 background-color: $custom-range-thumb-disabled-bg;
520 .custom-control-label::before,
523 @include transition($custom-forms-transition);