BaseInput
Extends:
Component → BaseInput
Direct Subclass:
Common Input Interface - ABSTRACT
PropTypes
property | type | type signature | description |
---|---|---|---|
name |
string |
required | input name (you can use dots and array indexes) |
placeholder |
string |
input placeholder (only some inputs) | |
label |
string |
input label | |
type |
string |
input type (only some inputs) | |
className |
string |
input class | |
controlClass |
string |
surrounding paragraph class | |
defaultValue |
any |
is used, when input value is falsey | |
value |
any |
use, when input is operated outside <Form> |
|
onChange |
function |
(value, input) => {} |
fired, when input is changed |
onFocus |
function |
(input) => {} |
fired, when input is focused |
onBlur |
function |
(input) => {} |
fired, when input is blured |
disabled |
boolean |
disable input | |
readOnly |
boolean |
only read | |
required |
boolean |
input is required - HTML attribute | |
maxLength |
number |
maximal length (only some inputs) | |
iconBefore |
any |
content shown before input | |
autoComplete |
string |
use "off" to disable autocomplete |
Example:
<Input
name="inputs[0].name"
label="Text of label"
className="input-class"
controlClass="control-container-class"
disabled
required
autofocus
readOnly
defaultValue="some value"
/>
Method Summary
Public Methods | ||
public |
getValue(): any Returns input value |
|
public |
resetValue(value: *) Reset and clean the validation errors |
|
public |
Show error |
|
public |
setValue(value: any): any Set new value to input |
Public Methods
public resetValue(value: *) source
Reset and clean the validation errors
Params:
Name | Type | Attribute | Description |
value | * |
|
leave empty to reset to default value |
public setError(error: string) source
Show error
Params:
Name | Type | Attribute | Description |
error | string |
|
error message or nothing to remove error |
public setValue(value: any): any source
Set new value to input
Params:
Name | Type | Attribute | Description |
value | any |
Return:
any |
Example:
// set default value
input.setValue()
// set value
input.setValue('another');