API

API

All of these props are optional and some also come with a default value. However, it's recommended to use at least the length, validChars and onChange/onComplete props.

OptionTypeDefaultDescription
valueString-The value of the verification input. Behaves like the value prop of a regular input element. This is necessary if the value needs to be changed from the outside (e.g. clearing the value). If you pass this prop, you are responsible to manage the value state. Otherwise the state will be kept inside the component.
lengthNumber6Number of characters the input should allow.
validCharsString'A-Za-z0-9'Set of characters the input should allow. The string is inserted into a regexp character set ( /[]/ ) for input validation.
placeholderString'·' (U+00B7)The character to display in empty fields. In order to use the blank character as a placeholder, specify this option as ' ' or ''.
autoFocusBooleanfalseFocus the input automatically as soon as it is rendered.
passwordModeBooleanfalseHide the input value by displaying * instead.
inputPropsObject{}The properties of this object get forwarded as props to the input element.
containerPropsObject{}The properties of this object get forwarded as props to the container element.
classNamesObject{}CSS class names to add to the specified elements.
onChangeFunction-Callback function that gets called with the string value whenever it changes.
onCompleteFunction-Callback function that gets called with the string value when the input is fully filled.
onFocusFunction-Callback function that gets called when the component obtains focus.
onBlurFunction-Callback function that gets called when the component loses focus.