Search code examples
iosmaterial-designtextfieldmdc-components

How to customise Material Design TextField Component error state iOS


Trying to customize the error state floating label colour and the inline error message font/colour but cannot find any option or in the docs.

enter image description here

MD Docs: https://material.io/develop/ios/components/textfields/


Solution

  • Use MDCTextInputControllerOutlined to change the error color of MDCTextField.

    var textField = MDCTextField()
    var textInputController = MDCTextInputControllerOutlined(textInput: textField)
    textInputController.errorColor = .red