Skip to content
Stylhero 0.6.2
React Native

Theme

Core

Feedback

Inputs

Navigation

Overlays

React Native / Inputs

Textarea

Multi-line text field: same label, hint and error behavior as TextField, a taller input that starts at the top, and an optional character count.

import { Textarea } from "@stylhero/native";

Example

import { useState } from "react";
import { Textarea } from "@stylhero/native";

function TextareaExample() {
  const [notes, setNotes] = useState("");
  return <Textarea label="Notes" value={notes} onChangeText={setNotes} maxLength={200} rows={3} />;
}

Props

PropTypeDefaultDescription
label required string - Visible label, also read by screen readers.
announceError boolean - Announce a new error to screen readers (iOS announcement, Android live region). Default true. Set it to false when the screen already moves focus to the first invalid field or shows its own error summary, so the error isn't read twice. The error is still in the field's hint either way.
disabled boolean -
error string - Error message. Turns the border red and is announced when it appears.
hint string - Help text under the field. Replaced by error when there is one.
inputStyle StyleProp<TextStyle> - Style for the input itself, e.g. a taller minHeight for several lines.
ref Ref<ComponentRef<typeof TextInput>> -
rows number 4 Sets the number of rows for a TextInput. Use it with multiline set to true to be able to fill the lines. Visible height in lines before the field scrolls. Default 4.
showCount boolean true With maxLength, show a "12/200" count under the field. Default true. Screen readers hear the limit in the hint instead of the running count.
style StyleProp<ViewStyle> -

Also takes React Native's TextInput props (testID, accessibilityHint, onLayout…), passed to that TextInput.

Accessibility

  • The visible label is the accessible name; the hint, or the error when there is one, is read as the accessibility hint.
  • With maxLength, the limit is in the hint; the visible "12/200" count isn't read on every keystroke.

Generated from src/components/Textarea.tsx. Something wrong or missing? Open an issue.