Skip to content
React NativeBeta

Textarea

Multi-line text with a fixed or auto-growing height and a grapheme-accurate character count.

Beta. React Native support is in beta. APIs may change or break between prereleases (npm tag native).

On this page
Web preview — real device may differ
tsx
import { Textarea } from "@/component-lib/textarea";
import { Section } from "./layout"; // Section and Row: page layout for the demo
 
export function TextareaDemo() {
  return (
    <Section title="Textarea">
      <Textarea label="Notes" placeholder="Anything we should know?" description="Fixed at 3 rows." />
      <Textarea
        label="Message"
        autoResize
        minRows={2}
        maxRows={6}
        showCount
        maxLength={140}
        placeholder="Grows from 2 to 6 rows, then scrolls"
        required
      />
      <Textarea label="Feedback" defaultValue="Too short" error="Write at least 20 characters." />
      <Textarea label="Read only" readOnly defaultValue={"Line one\nLine two"} rows={2} />
      <Textarea label="Disabled" disabled rows={2} />
    </Section>
  );
}

Install

npx @grampro/kit@native add Textarea

Usage

tsx
import { Textarea } from "@/component-lib/textarea";
 
<Textarea label="Message" autoResize minRows={2} maxRows={6} maxLength={140} showCount />

Props

TextareaProps

PropTypeDescription
valuestring
defaultValuestring
onValueChange(value: string) => voidThe new text on every change. onChangeText fires as well.
labelReactNodeThe field's name, shown above it.
descriptionReactNodeA hint under the field, read as the field's hint.
errorReactNodeMessage below the field; also marks it invalid.
sizeFieldSizeDefault md.
rowsnumberHeight in rows when not auto-resizing. Default 3.
autoResizebooleanGrow and shrink with the text, between minRows and maxRows. Default false.
minRowsnumberSmallest height in rows. Default rows, or 3.
maxRowsnumberLargest height in rows before the text scrolls. No limit by default.
showCountbooleanA character counter; shows count / maxLength when maxLength is set.
disabledboolean
readOnlyboolean
requiredbooleanMarks the label with an asterisk. Native has no form validation of its own.
styleStyleable<ViewStyle>
stylesPartial<{ root: Styleable<ViewStyle>; label: Styleable<TextStyle>; textarea: Styleable<…
localeTextPartial<TextareaLocaleText>

Also accepts the props of Omit<TextInputProps, "value" | "defaultValue" | "style" | "editable" | "multiline">.

Native and web

  • There is no resize handle on touch; use rows or autoResize.
  • Web version: Textarea on the web.