Skip to main content

TextArea

Large input allows users to enter a large amount of text and data.

Submit feedback
github
import { TextArea } from '@uhg-abyss/mobile';
() => {
const form = useForm();
return (
<FormProvider state={form}>
<TextArea
model="text-area-sandbox"
label="Sandbox Label"
hintText="Sandbox Hint Text"
maxLength={500}
/>
</FormProvider>
);
};

Using the useForm hook with FormProvider sets state for the component.

useState

Using the useState hook gets values from the component state.

Label

Use the label prop to display a label above the text area.

Error Message

Use the errorMessage prop to display a custom error message below the text area.

Success Message

Use the successMessage prop to display a custom success message below the text area.

Disabled

Set the isDisabled prop to true to disable the text area so users cannot enter a value.

MaxLength

Use the maxLength prop to set the maximum length of characters accepted as input. The amount of characters remaining will appear in the bottom right. The default value of maxLength is 500. Per accessibility requirements, the hintText prop should include the maximum number of characters a user can enter.

Help Content

Use the helpContent prop to display a help icon in the top right of the container, which will display the provided content in a modal screen when pressed.

TextArea Props

Prop NameTypeDefaultDescription
errorMessagestring-Error message to be displayed below input field
helpButtonAccessibilityLabelstring-Set the accessibility label for the help button
helpContentstring | ReactNode-When defined, displays a help icon that can be tapped to view the provided content in a modal screen
hintTextstring-Set the text displayed below label
isDisabledbooleanfalseFlag to enable/disable the input. If true, the input will be disabled
isRequiredbooleanfalseFlag to require text
labelstring-Label for input field
maxLengthstring500Set the maximum number of characters accepted as input
onBlurfunction-Callback fired every time the component is unfocused
onChangeTextfunction-Callback that is called when the text input text changes. Changed text is passed as a single string argument to the callback handler
onFocusfunction-Callback fired every time the component is focused
successMessagestring-Success message to be displayed below input field
valuestringValue of the text input

TextArea Classes

Class NameDescription
abyss-input-help-iconHelp icon element
abyss-input-help-modal-close-buttonHelp modal close button
abyss-input-help-modal-footerHelp modal footer
abyss-input-message-iconMessage icon
abyss-input-message-textMessage text
abyss-text-areaInput container
abyss-text-area-clear-buttonClear button
abyss-text-area-clear-textClear text
abyss-text-area-containerThe container around the text area
abyss-text-area-headerHeader element
abyss-text-area-help-buttonHelp button
abyss-text-area-help-modalHelp modal
abyss-text-area-hint-textInput hint text
abyss-text-area-labelLabel element
abyss-text-area-messageMessage element
abyss-text-area-remaining-count-textRemaining count text
abyss-text-area-rootRoot element

TextArea Translations

Translation KeyValue
helpHelp
closeClose
errorError
successSuccess
TextArea.clearclear
TextArea.charactersRemaining{{count}} characters remaining

TextArea Tokens

Token NameValue
input-header.color.text.label
#4B4D4F
input-header.color.text.hint
#4B4D4F
input-header.color.icon.help.rest
#196ECF
input-header.color.icon.help.active
#004BA0
input-message.color.text.error
#990000
input-message.color.text.success
#007000
input-message.color.icon.error
#990000
input-message.color.icon.success
#007000
input-field.color.surface.default
#FFFFFF
input-field.color.surface.disabled
#F3F3F3
input-field.color.text.input
#4B4D4F
input-field.color.border.rest.default
#4B4D4F
input-field.color.border.rest.error
#990000
input-field.color.border.rest.success
#007000
input-field.color.border.active.default
#196ECF
input-field.color.border.active.error
#990000
input-field.color.border.active.success
#007000
input-field.color.icon.utility.rest
#4B4D4F
input-field.color.icon.utility.disabled
#929496
input-field.color.icon.utility.active
#323334
input-character-count.color.text.label
#4B4D4F
input-character-count.color.text.link.rest
#196ECF
input-character-count.color.text.link.active
#004BA0
input-field.border-radius.all.container
4
input-field.border-width.all.container.rest
1
input-field.border-width.all.container.active
3
input-header.sizing.all.icon.help
24
input-message.sizing.all.icon.leading
20
input-field.sizing.icon.all.utility
20
input-field.sizing.icon.all.picker
20
input-container.spacing.gap.vertical.container
8
input-header.spacing.gap.horizontal.container
12
input-header.spacing.gap.horizontal.label
4
input-header.spacing.gap.vertical.content
4
input-message.spacing.gap.horizontal.container
4
input-field.spacing.padding.all.field
12
input-field.spacing.gap.horizontal.field
12
input-field.spacing.gap.horizontal.input-indicator
2
input-field.spacing.gap.horizontal.prefix-input
2
input-character-count.spacing.gap.horizontal.container
16
input-field.box-shadow.container.active
  • Shadow Color: $core.color.brand.60
  • Shadow Offset:
    • Width: 0
    • Height: 0
  • Shadow Opacity: 1
  • Shadow Radius: 4
input-field.box-shadow.container.error
  • Shadow Color: $core.color.red.120
  • Shadow Offset:
    • Width: 0
    • Height: 0
  • Shadow Opacity: 1
  • Shadow Radius: 4
input-field.box-shadow.container.success
  • Shadow Color: $core.color.green.100
  • Shadow Offset:
    • Width: 0
    • Height: 0
  • Shadow Opacity: 1
  • Shadow Radius: 4
Table of Contents