diff --git a/scss/_variables.scss b/scss/_variables.scss index e4d844ffd..3657aa522 100644 --- a/scss/_variables.scss +++ b/scss/_variables.scss @@ -695,6 +695,10 @@ $form-check-input-indeterminate-bg-color: $component-active-bg !default; $form-check-input-indeterminate-border-color: $form-check-input-indeterminate-bg-color !default; $form-check-input-indeterminate-bg-image: url("data:image/svg+xml,") !default; +$form-check-input-disabled-opacity: .5 !default; +$form-check-label-disabled-opacity: $form-check-input-disabled-opacity !default; +$form-check-btn-check-disabled-opacity: $btn-disabled-opacity !default; + $form-switch-color: rgba(0, 0, 0, .25) !default; $form-switch-width: 2em !default; $form-switch-padding-left: $form-switch-width + .5em !default; diff --git a/scss/forms/_form-check.scss b/scss/forms/_form-check.scss index 84e3e57d1..16a27246a 100644 --- a/scss/forms/_form-check.scss +++ b/scss/forms/_form-check.scss @@ -82,7 +82,7 @@ &:disabled { pointer-events: none; filter: none; - opacity: .5; + opacity: $form-check-input-disabled-opacity; } // Use disabled attribute in addition of :disabled pseudo-class @@ -90,7 +90,7 @@ &[disabled], &:disabled { ~ .form-check-label { - opacity: .5; + opacity: $form-check-label-disabled-opacity; } } } @@ -139,4 +139,13 @@ position: absolute; clip: rect(0, 0, 0, 0); pointer-events: none; + + &[disabled], + &:disabled { + + .btn { + pointer-events: none; + filter: none; + opacity: $form-check-btn-check-disabled-opacity; + } + } } diff --git a/site/content/docs/5.0/forms/checks-radios.md b/site/content/docs/5.0/forms/checks-radios.md index b6914ee42..ae89f5ee3 100644 --- a/site/content/docs/5.0/forms/checks-radios.md +++ b/site/content/docs/5.0/forms/checks-radios.md @@ -227,6 +227,11 @@ Create button-like checkboxes and radio buttons by using `.btn` styles rather th {{< /example >}} +{{< example >}} + + +{{< /example >}} + {{< callout info >}} Visually, these checkbox toggle buttons are identical to the [button plugin toggle buttons]({{< docsref "/components/buttons#button-plugin" >}}). However, they are conveyed differently by assistive technologies: the checkbox toggles will be announced by screen readers as "checked"/"not checked" (since, despite their appearance, they are fundamentally still checkboxes), whereas the button plugin toggle buttons will be announced as "button"/"button pressed". The choice between these two approaches will depend on the type of toggle you are creating, and whether or not the toggle will make sense to users when announced as a checkbox or as an actual button. {{< /callout >}} @@ -240,8 +245,11 @@ Visually, these checkbox toggle buttons are identical to the [button plugin togg - - + + + + + {{< /example >}} ### Outlined styles