suiss/uim · React Native Component

Textarea

A multi-line text field for longer input, with focus, invalid and disabled states.

Textarea is an open-source mobile component from suiss/uim for React Native and Expo, with SwiftUI and Jetpack Compose versions built from the same design tokens. The @esuiss/uim CLI copies its source into your project, so you own the code.

iOS
Textarea on iOS in light mode

Textarea is the multi-line version of Input. It wraps a TextInput through the same field control primitive, defaults to multiline with numberOfLines={8}, aligns text to the top and has a minimum height. It shows a focus border while editing, a danger border and tint when invalid, and muted colors when disabled.

Installation

$ pnpm dlx @esuiss/uim@latest add textarea

Manual

  1. Install the dependencies:
npx expo install cn
  1. Add the pieces it builds on: the primitives components/primitives/input.tsx, components/primitives/use-render.tsx.

  2. Copy the source into components/ui/textarea.tsx:

uniwind/components/ui/textarea.tsx
import { cn } from "cn"
import * as InputPrimitive from "@/components/primitives/input"
import { resolveClassName } from "@/components/primitives/use-render"

function Textarea({
  className,
  multiline = true,
  numberOfLines = 8,
  ...props
}: React.ComponentProps<typeof InputPrimitive.Root>) {
  return (
    <InputPrimitive.Root
      className={(state) =>
        cn(
          "min-h-16 w-full flex-row rounded-xl border border-transparent bg-control px-3 py-3 text-base text-label",
          state.focused && "border-focus",
  1. Update the import paths to match your project.

Usage

import { Textarea } from "@/components/ui/textarea"
<Textarea placeholder="Type your message here." />

Use it for comments, messages and other free-form text. Use Input for single-line values.

The value works controlled with value and onValueChange(value, details), or uncontrolled with defaultValue. Inside a Field, the textarea picks up the field's label, description, invalid and disabled state.

Override numberOfLines or set a height through className to change the visible size.

Examples

With value

A textarea that starts with a defaultValue.

iOS
Textarea (with value) on iOS in light mode

With label

A textarea inside a Field with a label and description.

iOS
Textarea (with label) on iOS in light mode

Disabled

A disabled textarea.

iOS
Textarea (disabled) on iOS in light mode

Invalid

A textarea inside an invalid Field with an error message.

iOS
Textarea (invalid) on iOS in light mode

API Reference

Textarea

ExtendsReact.ComponentProps<typeof InputPrimitive.Root>

Accessibility

  • Inside a Field, the textarea gets the field label as accessibilityLabel and the description as accessibilityHint.
  • disabled is set in accessibilityState and makes the textarea non-editable.
  • Outside a Field, give it an accessibilityLabel.

Notes

  • Uses the bg-control, border-focus, border-danger and bg-control-disabled tokens.
  • Placeholder, cursor and selection colors come from the label-secondary and accent tokens.
  • Light and dark colors follow the system appearance.