aboutsummaryrefslogtreecommitdiff
path: root/site/docs
diff options
context:
space:
mode:
authorMark Otto <[email protected]>2019-01-11 11:16:50 -0800
committerXhmikosR <[email protected]>2019-01-11 21:16:50 +0200
commitdeea117293951dd51f7c3c78a719c479f736c5cb (patch)
tree57cc0a63b5e7504797fece5a48dab4ca7f21f060 /site/docs
parentfd9dc1a0ca879f5624f4ef8c381136c506b0bff3 (diff)
downloadbootstrap-deea117293951dd51f7c3c78a719c479f736c5cb.tar.xz
bootstrap-deea117293951dd51f7c3c78a719c479f736c5cb.zip
Add form-validation-states Sass map (#27999)
Diffstat (limited to 'site/docs')
-rw-r--r--site/docs/4.2/components/forms.md31
1 files changed, 31 insertions, 0 deletions
diff --git a/site/docs/4.2/components/forms.md b/site/docs/4.2/components/forms.md
index 0026d3326..d1a6acc19 100644
--- a/site/docs/4.2/components/forms.md
+++ b/site/docs/4.2/components/forms.md
@@ -1107,6 +1107,37 @@ If your form layout allows it, you can swap the `.{valid|invalid}-feedback` clas
{% endcapture %}
{% include example.html content=example %}
+### Customizing
+
+Validation states can be customized via Sass with the `$form-validation-states` map. Located in our `_variables.scss` file, this Sass map is looped over to generate the default `valid`/`invalid` validation states. Included is a nested map for customizing each state's color and icon. While no other states are supported by browsers, those using custom styles can easily add more complex form feedback.
+
+Please note that we do not recommend customizing these values without also modifying the `form-validation-state` mixin.
+
+{% highlight scss %}
+// Sass map from `_variables.scss`
+// Override this and recompile your Sass to generate different states
+$form-validation-states: map-merge(
+ (
+ "valid": (
+ "color": $form-feedback-valid-color,
+ "icon": $form-feedback-icon-valid
+ ),
+ "invalid": (
+ "color": $form-feedback-invalid-color,
+ "icon": $form-feedback-icon-invalid
+ ),
+ ),
+ $form-validation-states
+);
+
+// Loop from `_forms.scss`
+// Any modifications to the above Sass map will be reflected in your compiled
+// CSS via this loop.
+@each $state, $data in $form-validation-states {
+ @include form-validation-state($state, map-get($data, color), map-get($data, icon));
+}
+{% endhighlight %}
+
## Custom forms
For even more customization and cross browser consistency, use our completely custom form elements to replace the browser defaults. They're built on top of semantic and accessible markup, so they're solid replacements for any default form control.