TextInput

January 22, 2026 · View on GitHub

Input field for single-line strings with various styling options and features including masking, scaling, and different states.

Usage

import { TextInput, InputSize, InputType } from "@docspace/ui-kit/components/text-input";
<TextInput
  type={InputType.text}
  size={InputSize.base}
  value="text"
  onChange={(event) => console.log(event.target.value)}
/>

With Mask

const mask = [/\d/, /\d/, "/", /\d/, /\d/, "/", /\d/, /\d/, /\d/, /\d/];
<TextInput
  type={InputType.text}
  mask={mask}
  placeholder="DD/MM/YYYY"
  guide
  keepCharPositions
  value=""
  onChange={(event) => console.log(event.target.value)}
/>

Properties

PropsTypeRequiredValuesDefaultDescription
typeInputTypetext, password, email, tel, search, number-Supported type of the input fields
valuestring--Value of the input
sizeInputSize-base, middle, largebaseSupported size of the input fields
onChangefunction---Called with the new value. Required when input is not read only
onBlurfunction---Called when field is blurred
onFocusfunction---Called when field is focused
onKeyDownfunction---Called when a key is pressed
onClickfunction---Called when clicked
onContextMenufunction---Called when context menu is triggered
idstring---Used as HTML id property
namestring---Used as HTML name property
classNamestring---CSS class name
styleCSSProperties---Inline CSS styles
placeholderstring---Placeholder text for the input
maxLengthnumber--255Maximum length of the input value
tabIndexnumber---Used as HTML tabindex property
autoCompletestring--"off"Used as HTML autocomplete property
isAutoFocussedboolean--falseFocus the input field on initial render
isDisabledboolean--falseIndicates that the field cannot be used
isReadOnlyboolean--falseIndicates that the field is displaying read-only content
hasErrorboolean--falseIndicates the input field has an error
hasWarningboolean--falseIndicates the input field has a warning
scaleboolean--falseIndicates the input field has scale (100% width)
withBorderboolean--trueIndicates that component contains border
isBoldboolean--falseWhen true, sets font weight to 600
fontWeightnumber, string---Sets the font weight of the input text
dirstring-ltr, rtl-Text direction
inputModestring-none, text, decimal, numeric, tel, search, email, url-Input mode for virtual keyboard
maskarray---Input text mask
guideboolean--falseWhen true, Text Mask shows both placeholder and non-placeholder mask characters
keepCharPositionsboolean--falseAllows adding/deleting characters without changing positions of existing ones
forwardedRefRef<HTMLElement>---Forwarded ref
testIdstring---HTML data-testid attribute