Button: Give the CSS passed in className higher priority
<Button buttonType={ButtonType.icon} onClick={this.onClickAttachmentButton} icon='attachment' className={classNames(['ms-icon-font-size-22', 'ms-bg-color-neutralLight-hover', 'ms-font-color-white'])}/>
Currently all the three ms symbols are ignored due the conflicting css from ms-Icon\ms-button-Icon.
From Button.tsx, I found the following code: const className = css((this.props.className), 'ms-Button', { 'ms-Button--primary': buttonType === ButtonType.primary, 'ms-Button--hero': buttonType === ButtonType.hero, 'ms-Button--compound': buttonType === ButtonType.compound, 'ms-Button--command': buttonType === ButtonType.command, 'ms-Button--icon': buttonType === ButtonType.icon, 'disabled': (renderAsAnchor && disabled) // add disable styling if it is an anchor // if not utilize default button disabled behavior. });
Can we fix this issue via moving this.props.className to be the last parameter? I'm not a CSS expert. But I guess the order may matter.
The order of classes within the attribute is irrelevant: <button class="button big"> is identical to <button class="big button">.
The issue here is that the className prop adds a class name onto the root element of the button. It generates output something like:
<button class="ms-Button ms-Button--icon largeIconButton">
<span class="ms-Button-icon">
<i class="ms-Icon ms-Icon--star"></i>
</span>
</button>
I believe what you're attempting to do is set the font size with a custom class like this:
/* Your custom override class. */
.largeIconButton {
font-size: 30px;
}
The problem is that the button component already has a style that targets the ms-Icon specifically:
/* Styles included in the Button component. */
.ms-Button--icon .ms-Icon {
font-size: 16px;
}
This style is more specific than the override class you've created, so it wins and your style is ignored. You need to write an override that targets the icon directly:
.largeIconButton .ms-Icon {
font-size: 40px;
}
Doing so overrides the default style that is built in to the button, and gives the desired result. Here's an example where I changed the size and color of an icon button:

I know there have been concerns around writing overrides that depend on the structure of the component. If the structure changes, won't the overrides break?
One way that we've addressed this concern is to have multiple className props. For example, Dialog provides className, containerClassName, and contentClassName. We could do the same for Button by adding an iconClassName prop, which would add a class name directly to the icon.
Doing so would allow you to use classes like ms-fontColor-green on an icon. The only trouble is that it doesn't scale very well. For a complex component there could be a dozen different class name props to target various parts of the component that may need styled. Is that messy, or an acceptable solution to stop developers from having to target parts of a component by class name?
@junchen1 Is this still something that is a problem for you? There have been quite a few changes to Button. Additionally, as Mike said order of class names does not impact how the styles are applied. The only thing that matters is the order of the styles in the actualy style sheet. Here is a quick stackoverflow that goes over that. http://stackoverflow.com/questions/3570423/does-the-order-of-styles-matter
@junchen1 I'm closing this for now. Please reopen a new issue if this is still a problem.