2

I need to apply a background color to a disabled button, but the following did not work and no error is shown in the browser's console.

Question

  1. Using styling hooks (mentioned here), how can I change the background color of a disabled button?

What I tried that didn't work

myLwc.html

<template>
    <lightning-button disabled variant="neutral" label="test" title="test" class="myDisabledClass"></lightning-button>
</template>

myLwc.css

.myDisabledClass {
  --slds-c-button-neutral-color-background-disabled: red;
}

1 Answer 1

0

I believe this is not currently possible (but used to be). In the "What's new" section of the SLDS documentation, it makes note of removing the disabled state styling hooks with an intent to implement them at the global/theme level. However, I don't think that's happened yet.

https://www.lightningdesignsystem.com/release-notes/ Check under "Release 2.14.0 - December 16, 2020"

I'd be very happy to be proved wrong, though....

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .