Text field

import { TextField } from "reshaped";
import type { TextFieldProps } from "reshaped";
Related components
Full keyboard navigation
Can be controlled and uncontrolled
Automatic integration with FormControl utility


Form fields have a required name property, so that's the only property you have to pass to TextField to start using it. If you need to handle its change events - add an onChange property to it.


Same as when using native inputs in React, TextField can be used as a controlled or uncontrolled component. By default, TextField is uncontrolled and lets you define its default value using the defaultValue property. In this case, all change events are handled automatically. This approach is helpful when you're pre-filling a form from a data source, but you don't need to control the further behavior of the input.

If you need to control the state of the field manually, you can use the value property. That will give you complete control of the component value and will stop handling the value automatically. You will have to update the state using the onChange handler and will be able to add custom logic before that happens.


You can use hasError property to show the user that TextArea is not passing the form validation.

You can disable TextField with the disabled flag. However, remember that disabling the field will remove it from the form submit query.


TextField has slots on both start and end sides, which you can use for displaying inline content, like text, badges, or inline actions.

Icon support

For consistent Icon usage in text fields, you can use startIcon and endIcon properties instead of slots and pass the icon SVG component.

Using with FormControl

To let the user know what data you expect them to type in, add labels or status messages to your fields with the help of the FormControl utility. Adding a placeholder should help even further by defining the field's data format.

Note: Don't use placeholders as labels for the fields as users won't see the placeholder when input contains a value.

Data types

TextField can be used with any type supported in the browsers by passing it to the inputAttributes.


  • When using TextField without a label - make sure to provide a text description. You can either provide the label by using the FormControl utility or by passing inputAttributes={{ 'aria-label': 'Your label' }} to the component if you don't want to display it visually.