Example: I understand we can achieve by using slds button base component but any other way directly to achieve through lwc.
<lightning-button label="Neutral" title="My Title" disabled class="myClass"></lightning-button>
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It only takes a minute to sign up.
Sign up to join this communityExample: I understand we can achieve by using slds button base component but any other way directly to achieve through lwc.
<lightning-button label="Neutral" title="My Title" disabled class="myClass"></lightning-button>
In lwc documentation you can find this statement about css hooks.
Use SLDS styling hooks to customize the component's styles. For example, specify the background color on the button with brand variant using the --sds-c-button-brand-color-background custom property.
Sample snippet:
.myClass {
--sds-c-button-brand-color-background-disabled: purple;
}
In your browser, if you would inspect the button, you could find the right css variable.
lightning button variant="brand"
) which OP doesn't seem to be using. Default, if you don't set a variant, is neutral
so button-neutral-color-background-disabled
. See example.
Sep 16, 2021 at 18:07