Theming

You can theme an MDCButton to match a Material Design button style using theming extensions. Learn more about theming extensions.

How to theme an MDCButton

First, import both Buttons and Buttons Theming and create an instance of MDCButton.

Swift

import MaterialComponents.MaterialButtons
import MaterialComponents.MaterialButtons_Theming

let button = MDCButton()

Objective-C

#import <MaterialComponents/MaterialButtons.h>
#import <MaterialComponentsBeta/MaterialButtons+Theming.h>

MDCButton *button = [[MDCButton alloc] init];

You can then provide a container scheme instance to any of the MDCButton theming extensions. Learn more about container schemes.

Material text button theming:

Swift

button.applyTextTheme(withScheme: containerScheme)

Objective-C

[self.button applyTextThemeWithScheme:self.containerScheme];

Material outlined button theming:

Swift

button.applyOutlinedTheme(withScheme: containerScheme)

Objective-C

[self.button applyOutlinedThemeWithScheme:self.containerScheme];

Material contained button theming:

Swift

button.applyContainedTheme(withScheme: containerScheme)

Objective-C

[self.button applyContainedThemeWithScheme:self.containerScheme];

How to theme an MDCFloatingButton

First, create a button and import the theming extension header for Buttons.

Swift

import MaterialComponents.MaterialButtons
import MaterialComponentsBeta.MaterialButtons_Theming

let floatingButton = MDCFloatingButton()

Objective-C

#import <MaterialComponents/MaterialButtons.h>
#import <MaterialComponentsBeta/MaterialButtons+Theming.h>

MDCFloatingButton *floatingButton = [[MDCFloatingButton alloc] init];

Material floating action button theming:

Swift

floatingButton.applySecondaryTheme(withScheme: containerScheme)

Objective-C

[self.floatingButton applySecondaryThemeWithScheme: self.containerScheme];