Skip to main content

IInput

Input field for single-line strings.

inputinput

Examples​

Search input with icon and hover effects

const searchInput: IInput = {
value: "",
onChange: (value) => {
return {
actions: [Actions.updateProps],
newProps: {
value
}
};
},
placeholder: "Search documents...",
size: InputSize.middle,
iconName: "search",
iconSize: 16,
iconColor: "#666666",
hoverColor: "#333333",
isIconFill: true,
}

Password input with validation and error handling

const passwordInput: IInput = {
value: "",
type: InputType.password,
onChange: (value) => {
const hasError = value.length < 8;
return {
actions: [Actions.updateProps],
newProps: {
value,
hasError
}
};
},
onBlur: (value) => {
if (value.length < 8) {
return {
actions: [Actions.showToast],
toastProps: [{
title: "Password must be at least 8 characters long",
type: ToastType.error
}]
};
}
},
placeholder: "Enter password",
name: "password",
autoComplete: InputAutocomplete.off,
size: InputSize.big,
isAutoFocused: true,
hasError: false,
maxLength: "32"
}

Properties​

PropertyTypeDescription
valuestringDefines the input value.
onChange(value: string) => void | IMessageSets a function which is triggered whenever the input value is changed. It is required when the input is not read-only. The changed input value is passed to the function, which passes it back in the "value" parameter.
namestringDefines the input HTML "name" property.
placeholderstringDefines the input placeholder text.
maxLengthstringDefines the default maximum length of the input value.
sizeInputSizeDefines the input size.
isAutoFocusedbooleanSpecifies whether to focus the input field when initially rendered.
isReadOnlybooleanSpecifies whether the input field displays the read-only content.
hasErrorbooleanSpecifies whether to indicate that there is an error in the input field.
hasWarningbooleanSpecifies whether to indicate that there is a warning in the input field.
scalebooleanSpecifies if the input field is scaled or not.
autoCompleteInputAutocompleteDefines the input HTML "autocomplete" property.
tabIndexnumberDefines the input HTML "tabindex" property.
mask[]Defines the input text mask.
isDisabledbooleanSpecifies that the field cannot be used (e.g the user is not authorized, or the changes are not saved).
typeInputTypeThe input field type.
keepCharPositionsbooleanSpecifies whether the characters are allowed to be added or deleted without changing the positions of the existing characters.
onBlur(value: string) => void | IMessageSets a function which is triggered whenever the input field is blurred.
onFocus(value: string) => void | IMessageSets a function which is triggered whenever the input field is focused.
childrenNode | Node[]Defines the input field components.
iconSizenumberDefines the input icon size.
iconNamestringDefines the path to the input icon.
isIconFillbooleanSpecifies if the icon fill is needed or not.
iconColorstringDefines the input icon color.
hoverColorstringDefines the icon color on hover action.
iconButtonClassNamestringDefines the class name of the icon button.
onIconClick() => voidSets a function which is triggered whenever the input icon is clicked.
classNamestringDefines the CSS class for styling the component. Can be used to override or extend the default component styles.

InputSize​

The supported input sizes.

Enumeration Members​

base​

base: "base";

Base size of the input field.

middle​

middle: "middle";

Middle size of the input field.

big​

big: "big";

Big size of the input field.

huge​

huge: "huge";

Huge size of the input field.

large​

large: "large";

Large size of the input field.


InputAutocomplete​

The input autocomplete feature.

Enumeration Members​

on​

on: "on";

Autocomplete is enabled.

off​

off: "off";

Autocomplete is disabled.


InputType​

The supported input types.

Enumeration Members​

text​

text: "text";

Text input type.

password​

password: "password";

Password input type.