[SalesForce] Remove base styles from lightning component framework to use LDS

Adding a ui:button in Lightning Component Framework results in classes
uiButton–default and uiButton being added.

In order to use Lightning Design System, I need to remove these classes (or override the CSS styling for these classes). I'm using LDS classes slds-button slds-button–brand.

I can't see an obvious way to turn off all default LCF styling in order to use LDS. Although I can see responses on a previous question indicating this has been resolved?

Thanks!

Best Answer

In init method you can do like this. Find the button by Id. Use aura:id

<ui:button label="New Milestone" press="{!c.newMilestone}" class="slds-button slds-button--brand" aura:id="newmilestonebutton" />

var newbutton = component.find('newmilestonebutton');
$A.util.removeClass(newbutton, 'uiButton--default uiButton');

Or do the same thing in afterRender() method in Renderer file. You have to override the afterRender() method.