Data Driven Forms provides two constants files to keep consistency across all projects and prevent typos.

Strings values used in component field attributes.

import componentTypes from '@data-driven-forms/react-form-renderer/dist/cjs/component-types';

Available keys:

{
TEXT_FIELD,
FIELD_ARRAY,
CHECKBOX,
SUB_FORM,
RADIO,
TABS,
DATE_PICKER,
TIME_PICKER,
WIZARD,
SWITCH,
TEXTAREA,
SELECT,
PLAIN_TEXT,
SLIDER,
DUAL_LIST_SELECT,
BUTTON,
INPUT_ADDON_GROUP,
INPUT_ADDON_BUTTON_GROUP,
}

Usage:

{
component: componentTypes.TEXT_FIELD,
name: 'login'
}

Strings values used in validate type attribute.

import validatorTypes from '@data-driven-forms/react-form-renderer/dist/cjs/validator-types';

Available keys:

{
REQUIRED,
MIN_LENGTH,
MAX_LENGTH,
EXACT_LENGTH,
MIN_ITEMS,
MIN_NUMBER_VALUE,
MAX_NUMBER_VALUE,
PATTERN,
URL,
}

Usage:

{
component: componentTypes.TEXT_FIELD,
name: 'login',
validate: [{type: validatorTypes.REQUIRED}]
}