How can you change the Lightning button’s variant by clicking the button in LWC?
I want to change the variant once I click the Lightning button. I have tried to build a JavaScript code based on that. But I cannot find any way to do that. I am at a loss here. Can I get any suggestion as to how I can change the variant whenever I click on the Lightning button.
JS Code:
You can take help from destructing assignment: [a, b] = [b, a] to change the variant of the Lightning button. You can swap the two variables. If you store a the default variant in yearlyVariant and monthlyVariant, you can have: