@source4society/react-web-input-field-with-label
v1.0.0
Published
Input field with label and validation error messages
Downloads
1
Readme
react-web-input-field-with-label
Input field with label and validation error messages for the web, useful with redux-form.
Installation
npm install @source4society/react-input-field-with-label
or
yarn add @source4society/react-input-field-with-label
Usage
If you have a redux-form setup, and you are using the Field
component, you can pass this in as the component
prop as follows:
<Field labelText="Your label text here" name="fieldName" id="fieldId" component={InputFieldWithLabel} type="email" />
The different props are as follows:
labelText // Defines the text used in the label
labelClasses // Add custom label classes to the label
labelAttributes // Attributes for the label tag, such as `for`
input // The input field object, provided by redux-form
type // The type of input field, defaults to text
className // Custom class for the entire component
meta: // an object containing the 'touched' and 'error' properties, supplied by redux-form
readOnly: // Whether or not the form is readOnly