```html_example
-<button type="button" class="button" disabled>Disabled</button>
<a class="button disabled" href="#" aria-disabled>Disabled</a>
+<button type="button" class="button primary" disabled>Disabled</button>
+<button type="button" class="button secondary" disabled>Disabled</button>
+<button type="button" class="button success" disabled>Disabled</button>
+<button type="button" class="button alert" disabled>Disabled</button>
+<button type="button" class="button warning" disabled>Disabled</button>
```
---
}
/// Adds disabled styles to a button by fading the element, reseting the cursor, and disabling pointer events.
-@mixin button-disabled($color: $primary-color) {
+/// @param [Color] $background [$primary-color] - Background color of the disabled button.
+/// @param [Color] $color [$button-color] - Text color of the disabled button. Set to `auto` to have the mixin automatically generate a color based on the background color.
+@mixin button-disabled(
+ $background: $primary-color,
+ $color: $button-color
+) {
+ @if $color == auto {
+ $color: color-pick-contrast($background, ($button-color, $button-color-alt));
+ }
+
opacity: $button-opacity-disabled;
cursor: not-allowed;
- &:hover, &:focus {
- background-color: $color;
- color: $button-color;
+ &, &:hover, &:focus {
+ background-color: $background;
+ color: $color;
}
}
@each $name, $color in $button-palette {
&.#{$name} {
- @include button-disabled($color);
+ @include button-disabled($color, auto);
}
}
}