Maturity
Text Area Control
Text Area Field
Overview
Benefits
- 1:1 parity design/development.
- Simplified properties and usage
- On the design side, we simplified the rules and styling, all available via semantic tokens.
- On the code side, we removed properties that should belong to the parent container, hardcoded values, and magic numbers.
- Better accessibility, with holistic interaction states, colors, and more.
How to migrate
In most situations TextAreaField should be a direct replacement for Text with a combined FormGroup.
// Before
<>
<Text as="label" variant="bodyBold" htmlFor="bulk_items_textarea">
Paste {textItemPlural} separated by a comma or new line
</Text>
<Textarea
autoFocus
id="bulk_items_textarea"
minRows={12}
maxRows={12}
mt="4px"
onChange={onChangeValue}
placeholder={`Add ${textItemPlural} spaced by a comma, or enter`}
type="text"
value={value}h
/>
</>
// After
<TextAreaField
label={`Paste ${textItemPlural} separated by a comma or new line`}
autoFocus
onChange={onChangeValue}
placeholder={`Add ${textItemPlural} spaced by a comma, or enter`}
value={value}
/>
If previously you were using TexareaDeprecated as a standalone control, not part of a form, use TextAreaControl.
Also keep in mind TextAreaField and TextAreaControl can work as either a control component (you handle the state when it changes and pass the value) or has uncontrolled component (state is handled internally and you can set the defaultVaule).
Pick one pattern or the other not both.
How to migrate
maxRows / minRows
The maxRows and minRows props have been removed as TextAreaField and TextAreaControl has a set min-height and can be rezied manually.
id
The id prop still exists on TextAreaField, but if you were previously using it to connect the FieldGroup to Textarea, you can remove it as TextAreaField does this internally for you.
size
The size prop has been updated as the lg has been removed and remaining values have been renamed to match a more consistent t-shirt naming pattern.
|
Before |
After |
|---|---|
|
sm |
SM |
|
m |
MD |
|
lg |
REMOVED |
validation
The validation prop has been removed as Fields and Controls no longer have warning or success statuses and instead pass the error message to the new error prop.
Any warning will end up as an error and success will be completely removed.
width
The width prop has been removed as TextAreaField and TextAreaControl already are set to fill their entire container.