Skip to content

A platform for community discussion. Free, open, simple.

UX: Add disabled styling to `<DToggleSwitch/>` (#22988)

Keegan George1ded0a14291c
diff --git a/app/assets/stylesheets/common/components/d-toggle-switch.scss b/app/assets/stylesheets/common/components/d-toggle-switch.scss
index 8145a45240c..f24dfd04eb6 100644
--- a/app/assets/stylesheets/common/components/d-toggle-switch.scss
+++ b/app/assets/stylesheets/common/components/d-toggle-switch.scss
@@ -13,7 +13,7 @@
background-color: var(--primary-high);
}
- .d-toggle-switch__checkbox[aria-checked="true"]
+ .d-toggle-switch__checkbox[aria-checked="true"]:not([disabled])
+ .d-toggle-switch__checkbox-slider {
background-color: var(--tertiary-hover);
}
@@ -41,6 +41,15 @@
left: calc(var(--toggle-switch-width) - 22px);
}
+ &__checkbox[disabled] + .d-toggle-switch__checkbox-slider {
+ opacity: 0.5;
+ cursor: not-allowed;
+
+ &::before {
+ cursor: not-allowed;
+ }
+ }
+
&__checkbox-slider {
display: inline-block;
cursor: pointer;