Theming

You can theme a text field to match the Material Design style by importing a theming extension. The content below assumes you have read the article on Theming.

First, import the text field theming extension and create a text field.

Swift

import MaterialComponents.MaterialTextControls_OutlinedTextFieldsTheming

let textField = MDCOutlinedTextField()

Objective-C

#import <MaterialComponents/MaterialTextControls+FilledTextFieldsTheming.h>

MDCFilledTextField *filledTextField = [[MDCFilledTextField alloc] init];

Then pass a container scheme to one of the theming methods on the theming extension.

Swift

filledTextField.applyTheme(withScheme: containerScheme)

Objective-C

[self.filledTextField applyThemeWithScheme:self.containerScheme];