This guide helps you migrate from the deprecated TextField component with multiline prop to using the Textarea component directly.
The multiline prop has been removed from TextField component. Users should now use the Textarea component directly for multiline text input.
- Better type safety: Removes complex union types that prevented proper onChange event typing
- Clearer separation: TextField for single-line input, Textarea for multiline input
- Simpler implementation: Reduces complexity and follows native HTML patterns more closely
Before:
import { TextField } from '@equinor/eds-core-react'
<TextField
multiline
label="Description"
placeholder="Enter description"
/>After:
import { Textarea } from '@equinor/eds-core-react'
<Textarea
label="Description"
placeholder="Enter description"
/>Before:
<TextField
multiline
label="Comments"
rows={3}
rowsMax={10}
/>After:
<Textarea
label="Comments"
rows={3}
rowsMax={10}
/>Before:
<TextField
multiline
label="Feedback"
variant="error"
helperText="This field is required"
/>After:
<Textarea
label="Feedback"
variant="error"
helperText="This field is required"
/>Before:
<TextField
multiline
label="Notes"
onChange={(event: ChangeEvent<HTMLTextAreaElement>) => {
console.log(event.target.value)
}}
/>After:
<Textarea
label="Notes"
onChange={(event) => {
// No manual type annotation needed!
console.log(event.target.value)
}}
/>Before:
const textareaRef = useRef<HTMLTextAreaElement>(null)
<TextField
multiline
textareaRef={textareaRef}
label="Content"
/>After:
const textareaRef = useRef<HTMLTextAreaElement>(null)
<Textarea
ref={textareaRef}
label="Content"
/>| Feature | TextField (old multiline) | Textarea (new) |
|---|---|---|
| Label | ✅ | ✅ |
| Helper Text | ✅ | ✅ |
| Meta Text | ✅ | ❌ (not needed for textarea) |
| Variants | ✅ | ✅ |
| Icons | ✅ | ❌ (not typical for textarea) |
| Units | ✅ | ❌ (not typical for textarea) |
| rowsMax | ✅ | ✅ |
| onChange typing | ❌ Required manual | ✅ Automatic |
For simple cases, you can use find and replace:
- Find:
<TextField([^>]*)multiline([^>]*)> - Replace:
<Textarea$1$2>
Note: This is a basic pattern and may need manual adjustment for complex cases.
We provide a codemod to help automate this migration. See CODEMOD.md for details.
The following cases need manual review:
- InputWrapper with custom styling - You may need to wrap Textarea with InputWrapper
- Complex conditional rendering - Check if multiline was used conditionally
- TypeScript types - Update any type references from
TextFieldPropstoTextareaProps - Ref handling - Change
textareaReftoref - Props like inputIcon, unit - These are not available on Textarea and need alternative solutions
After migrating, ensure:
- ✅ All multiline text inputs still render correctly
- ✅ Form validation still works
- ✅ Event handlers (onChange, onBlur, etc.) function as expected
- ✅ Refs are properly connected
- ✅ No TypeScript errors
- ✅ Visual appearance matches expected design
If you encounter issues during migration:
- Review the examples in this guide
- Create an issue on GitHub with details about your use case
The Textarea component accepts all standard HTML textarea attributes plus:
type TextareaProps = {
placeholder?: string
variant?: 'error' | 'warning' | 'success'
disabled?: boolean
readOnly?: boolean
rowsMax?: number
label?: string
helperText?: string
} & TextareaHTMLAttributes<HTMLTextAreaElement>The following TextField-specific props are NOT available on Textarea:
inputIcon- Icons are not typical for textareasunit- Units are not typical for textareasmeta- Use helperText instead