README
react-forms
Install
Install this package with npm
npm i @salsita/react-forms
or yarn
yarn add @salsita/react-forms
API
Modules
Functions
- formsReducer(state, action) ⇒
FormsState
The reducer of the forms module
- FormFieldSelect(props)
A form field component for select
- FormField(props)
A form field component for input
Interfaces
FormValidations
- FormValidations
- .isEmail(value) ⇒
string
|undefined
- .notEmptyString(message) ⇒
function
- .notEmptyObject(message) ⇒
function
- .isEmail(value) ⇒
string
| undefined
FormValidations.isEmail(value) ⇒ Validates an email address
Kind: static method of FormValidations
Returns: string
| undefined
- An error message
Param | Type | Description |
---|---|---|
value | string | undefined |
The input value |
function
FormValidations.notEmptyString(message) ⇒ Creates a validation function that checks if the input value is not an empty string
Kind: static method of FormValidations
Returns: function
- The validation function
Param | Type | Description |
---|---|---|
message | string |
The error message |
function
FormValidations.notEmptyObject(message) ⇒ Creates a validation function that checks if the input value is not an empty object
Kind: static method of FormValidations
Returns: function
- The validation function
Param | Type | Description |
---|---|---|
message | string |
The error message |
FormFieldSelectProps
Kind: global interface
Properties
Name | Type | Description |
---|---|---|
[label] | string |
Label of the field |
FormFieldProps
Kind: global interface
Properties
Name | Type | Description |
---|---|---|
type | string |
Input type |
[label] | string |
Label of the field |
FormsState
formsReducer(state, action) ⇒ The reducer of the forms module
Kind: global function
Param | Type | Description |
---|---|---|
state | FormsState |
The state of redux-form |
action | Action |
A redux action |
FormFieldSelect(props)
A form field component for select
Kind: global function
Param | Type | Description |
---|---|---|
props | FormFieldSelectProps |
Properties |
FormField(props)
A form field component for input
Kind: global function
Param | Type | Description |
---|---|---|
props | FormFieldProps |
Properties |