Input
The Input component is a basic input component which users can use to enter values into it.
Usage#
Code#
Sizes#
The input component uses width and height properties for the size of the component. Both the props accepts number values.
The default value for width is 300 and height is 32
Code#
Icon Input#
The input field can have a icon by using the props suffix and prefix
Code#
Disabled#
The input field can be disabled by using a boolean prop called disabled
Code#
Validation#
The validation of input field is done by two props isValid and validationText. The isValid prop
is a boolean which denotes the validation for the field and validationText acts as a validation message
The
validationTextprop is not mandatory for indicating validation
Code#
Controlled Usage#
The Input component from Palette is same as the input use value and onChange props to control the field value.
Use event.target.value from onChange to set the value
API#
| Prop | Type | Possible values | Default Value |
|---|---|---|---|
| placeholder | string | Any string value | "" |
| height | number | Any number accepted values | 400 |
| width | number | Any number accepted values | 400 |
| disabled | boolean | true and false | false |
| suffix | ReactNode | - | - |
| prefix | ReactNode | - | - |
| isInvalid | boolean | true and false | false |
| validationText | string | Any string value | "" |
| value | any | Any | - |
| onChange | ()=>void | - | - |
Built by Akshay 🤙