1 // Form control focus state
3 // Generate a customized focus state and for any input with the specified color,
4 // which defaults to the `$input-focus-border-color` variable.
6 // We highly encourage you to not customize the default value, but instead use
7 // this to tweak colors on an as-needed basis. This aesthetic change is based on
8 // WebKit's default styles, but applicable to a wider range of browsers. Its
9 // usability and accessibility should be taken into account with any change.
11 // Example usage: change the default blue border and shadow to white for better
12 // contrast against a dark gray background.
13 @mixin form-control-focus() {
15 color: $input-focus-color;
16 background-color: $input-focus-bg;
17 border-color: $input-focus-border-color;
19 // Avoid using mixin so we can pass custom focus shadow properly
21 box-shadow: $input-box-shadow, $input-focus-box-shadow;
23 box-shadow: $input-focus-box-shadow;
29 @mixin form-validation-state($state, $color) {
33 margin-top: $form-feedback-margin-top;
34 font-size: $form-feedback-font-size;
43 max-width: 100%; // Contain to parent when possible
44 padding: $tooltip-padding-y $tooltip-padding-x;
46 font-size: $tooltip-font-size;
47 line-height: $line-height-base;
48 color: color-yiq($color);
49 background-color: rgba($color, $tooltip-opacity);
50 @include border-radius($tooltip-border-radius);
55 .was-validated &:#{$state},
61 box-shadow: 0 0 0 $input-focus-width rgba($color, .25);
64 ~ .#{$state}-feedback,
65 ~ .#{$state}-tooltip {
72 .was-validated &:#{$state},
74 ~ .#{$state}-feedback,
75 ~ .#{$state}-tooltip {
82 .was-validated &:#{$state},
88 ~ .#{$state}-feedback,
89 ~ .#{$state}-tooltip {
95 .custom-control-input {
96 .was-validated &:#{$state},
98 ~ .custom-control-label {
102 background-color: lighten($color, 25%);
106 ~ .#{$state}-feedback,
107 ~ .#{$state}-tooltip {
112 ~ .custom-control-label::before {
113 @include gradient-bg(lighten($color, 10%));
118 ~ .custom-control-label::before {
119 box-shadow: 0 0 0 1px $body-bg, 0 0 0 $input-focus-width rgba($color, .25);
127 .was-validated &:#{$state},
129 ~ .custom-file-label {
130 border-color: $color;
132 &::after { border-color: inherit; }
135 ~ .#{$state}-feedback,
136 ~ .#{$state}-tooltip {
141 ~ .custom-file-label {
142 box-shadow: 0 0 0 $input-focus-width rgba($color, .25);