To use Formalizer with Material UI you can simply import the setupForMaterialUI
function and call it:
import { setupForMaterialUI } from 'formalizer';
...
// then, somewhere in your app's bootstraping code just call it
setupForMaterialUI();
Now you can use Formalizer with Material UI's inputs such as TextField
, and they will error out and display error messages automatically.
All this function does is set the invalidAttr
and helperTextAttr
settings to the following values:
FormalizerSettings.invalidAttr = { error: true };
FormalizerSettings.helperTextAttr = 'helperText';
You can learn more about this settings here.