0.2.5 • Published 2 years ago

@essappstate/canopy-react-inputfield v0.2.5

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

@essappstate/canopy-react-inputfield

Creates a input field for a form. Granted, may be overkill, but it helps with labels and such. Works with AppStateESS/Canopy.

Install

npm install --save-dev @essappstate/canopy-react-inputfield

Example

import InputField from '@essappstate/canopy-react-inputfield'

setUsername(val) {
  this.setState({username: val})
}

render() {
  <InputField
    name="username"
    label="Username"
    value={this.state.username}
    change={this.setUsername.bind(this)}
    required={true}/>
}

Properties

Prop nameTypeDescription
namestringName parameter of input
labelstringA label that displays before the input
typestringtext, password, date, datetime, etc.
valuestring,numberValue to appear in the field. Should couple to the state
changefunctionFunction called on change
blurfunctionFunction call when input blurred
placeholderstringDefault placeholder text shown in the input
errorMessagestringError message you want to appear under the input field
iidstringId parameter of input
autocompletebooleanThe autocomplete status. Default true (not shown)
requiredbooleanWhether input field is required for form. Will warn when blurred
disabledbooleanIf true, input will be disabled and unaccessible
sizestring,numberSize of input (will not affect width due to Bootstrap 100%)
maxLengthnumberMaximum number of characters allowed in field
wrapfunctionFunction that will receive the input field only. Useful if you want to wrap the input in tag but not the label
selectOnClickbooleanIf true, the value in the input will be highlighted for replacement
onEmptyfunctionFunction that should be run if the input is empty and blurred
disableRequireCheckbooleanDisable the blur empty check when flagged as required. Lets you set your own way of handling empty inputs.
0.2.5

2 years ago

0.2.4

3 years ago

0.2.3

4 years ago

0.2.2

4 years ago

0.2.1

5 years ago

0.2.0

6 years ago