The input is a single-line text field for user-inputted data.

Example

⌘ Cmd + ⌥ Option + 1

Properties

propertypropTyperequireddefaultdescription
notestring-nullForm note for the input
defaultValuestring--The default value of the input used on initial render
displayErrorbool--Includes search icon if true
isDisabledbool--Prevents input from being modified and appears disabled
isFilterbool--Includes error if true
isOptionalcustom-- Adds an optional label if there is a label provided
@param {Object} props Object of props

@returns {Error} Error or null
isReadOnlybool--Prevents input from being modified but doesn't appear disabled
isRequiredbool--Prevents input from being submitted without value
labelstring--Text that describes the input
maxnumber--Max value for the `input`. Should be used only when `type` is `number`.
maxLengthnumber-- Max length of the input value. Should be used only when type is 'text',
'email', 'search', 'password', 'tel', or 'url'.
minnumber--Min value for the `input`. Should be used only when `type` is `number`.
onBlurfunc-- Function that fires when the input loses focus. It fires regardless of
whether the value has changed.
onChangefunc--Function that fires when the input loses focus after the value changes
onFocusfunc--Function that fires when the input gains focus
onInputfunc--Function that fires on keypress
onKeyDownfunc--Function that fires when a key is pressed down
placeholderstring--Input placeholder text
stepstring--Input step value
testSectionstring--Hook for automated JavaScript tests
textAlignoneOf 'left' | 'right'--Align text inside input. Default is left.
typeoneOf 'text' | 'password' | 'date' | 'number' | 'email' | 'url' | 'search' | 'tel'yes-Supported input types
valuestring | number--Text within the input

Usage

Use an input field when requesting text or numeric input from the user.

Best Practices

Do

Make input field widths consistent

Don't

Use an input for read-only data