Skip to main content
Brand and assets
Build
Monitor and contribute
/
Component library
  • All components
  • Buttons & actions
  • Forms & inputs
    • Checkbox
    • ChoiceGroup
    • CurrencyInput
    • DateInput
    • FileInputZone
    • Filters
    • Form
    • MaskedTextInput
    • PasswordInput
    • Pill
    • Pill
    • Radio
    • SearchInput
    • SegmentedSlider
    • Select
    • Switch
    • TextArea
    • TextInput
  • Layout & containers
  • Overlays
  • Feedback & status
  • Data display
  • Typography
  • Accessibility
  • Contrib
  • Deprecated
  • Forms & inputs
  • TextArea

TextArea

Captures text over several lines. `autosize` grows the field with the content.

Health
Component health
Source
View on Github
Design
View Figma
Storybook
View in Storybook
Playground
No Example
Accessibility

compliant

Platform
Universal
  • Overview
  • Props
  • Figma

Usage​

Input help text

Autosize​

When using the autosize prop, the component will automatically resize to fit the content. This is useful for capturing long-form text input. This behavior is always active when the on mobile.

Controlled​

import { useState } from "react";
import { TextArea } from "murray";

function Demo() {
const [value, setValue] = useState("");
return <TextArea value={value} onChange={(newValue) => setValue(newValue)} />;
}

Error state​

Invalid name

Disabled state​

Condensed theme​

For applications with condensed theme density, this component renders in a condensed style:

With SX prop​

You can pass positional props to the component:

Usage in <Form>​

On web, TextArea can be used in <Form> component and be controleld by Formik:

A comment with "Alan" in it.

Playground​

Loading...
tip
This component is universal, its usage is the same in murray and murray/mobile.

TextArea props

NameTypeDefault ValueDescriptionUsage count
aria-describedbystringId of an element outside the input that also describes it, such as an error shared by several inputs
aria-labelstringAccessibility label, only necessary when not associated with a label
aria-labelledbystring
aria-requiredbooleanOverrides `aria-required` set by `required`, to mark the input as mandatory without the asterisk
autoFocusbooleanIf true, focuses the input on componentDidMount.The default value is false.
autosizebooleanIf true, multiline input will automatically grow based on its content, up to `numberOfLines`. On iOS, it starts at a single line instead of the `numberOfLines` height.
cursorCursorEnforce a cursor type
defaultValuestringUncontrolled default value.
disabledbooleanDisable input
enterKeyHint"search""done""go""next""send"
errorReactNodeContents of `InputError` component, if not set, error is not rendered.
focusedbooleanShow focus styles even when the input isn't focused, e.g. while a readonly input's picker is open
helpTextReactNodeContents of `InputHelp` component, if not set, description is not rendered.
idstring
labelReactNode
maxstringnumber
maxLengthnumberMaximum string length that the user can enter in UTF-16 code units
minstringnumber
minLengthnumberMaximum string length that the user can enter in UTF-16 code units
namestringHtml input name
numberOfLinesnumberEnforce a number of lines when input is multiline.
onChange((value: string) => void)Trigger when input value is changing
onPress((event: GestureResponderEvent) => void)
placeholderstring
readonlybooleanMake input readonly
render
1 possibilities((elements: { input: ReactNode; prefix?: ReactNode; suffix?: ReactNode; }, pseudoState: PseudoState) => ReactNode)
Fully control how input, prefix and suffix are rendererd
renderPlaceholder(() => ReactNode)To render a custom placeholder view when the field is empty
requiredbooleanAdds required attribute to the input and a red asterisk on the right side of label, `false` by default Determines whether the input should have `aria-required` attribute
resizeResizeEnforce a resize type when input is multiline
stepstringnumber
sxPositionPropsPositioning properties
titlestringHtml input title
typeHTMLInputTypeAttributeHTML input type
valuestringControl the input.

Undocumented props

NameTypeDefault ValueDescriptionUsage count
clearButtonModeany
enablesReturnKeyAutomaticallyany
onBlurany
onFocusany
onKeyPressany
refany
returnKeyTypeany
submitBehaviorany

Style API​

Use sx for one-off adjustments. It accepts these style keys:

alignSelfanimationaspectRatiobottomcursordisplayendflexflexBasisflexGrowflexShrinkheightinsetinsetInlineinsetInlineEndinsetInlineStartleftmarginmarginBottommarginHorizontalmarginInlinemarginInlineEndmarginInlineStartmarginLeftmarginRightmarginTopmarginVerticalmatrixmaxHeightmaxWidthminHeightminWidthopacityperspectivepositionrightrotaterotateXrotateYrotateZscalescaleXscaleYskewXskewYstarttoptransformtransformOriginwidthxyzIndex

Each can be overridden per breakpoint with:

$lg$ltLg$ltMd$ltSm$ltVs$ltXl$ltXxl$md$sm$vs$xl$xs$xxl
Edit this page
Previous
Switch
Next
TextInput
  • Usage
  • Autosize
  • Controlled
  • Error state
  • Disabled state
  • Condensed theme
  • With SX prop
  • Usage in <Form>
  • Playground

Input help text