Skip to content

Latest commit

 

History

History
25 lines (16 loc) · 764 Bytes

material-ui.md

File metadata and controls

25 lines (16 loc) · 764 Bytes

Material UI integration

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.

How it works under the hood

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.