This is an illustration of a Themed Textarea component with default configuration.
size
isReadOnly
isInvalid
isDisabled
<Textarea
size="md"
isReadOnly={false}
isInvalid={false}
isDisabled={false}
w="$64"
>
<TextareaInput placeholder="Your text goes here..." />
</Textarea>

API Reference

Import

To use this component in your project, include the following import statement in your file.
import { Textarea } from '@gluestack-ui/themed';

Anatomy

The structure provided below can help you identify and understand a Textarea component's various parts.
export default () => (
<Textarea>
<TextareaInput />
</Textarea>
)

Component Props

This section provides a comprehensive reference list for the component props, detailing descriptions, properties, types, and default behavior for easy project integration.

Textarea

It inherits all the properties of React Native's View component.
Prop
Type
Default
Description
size
'sm' | 'md' | 'lg' | 'xl'
'md'
Changes the size of the Input Text
isInvalid
bool
false
When true, the input displays an error state.
isDisabled
bool
false
When true, the input is disabled and cannot be edited.
isHovered
bool
false
When true, the input displays a hover state.
isFocused
bool
false
When true, the input displays a focus state.
isRequired
bool
false
If true, sets aria-required="true" on the input.
isReadOnly
bool
false
If true, the input value cannot be edited.
Descendants Styling Props Props to style child components.
Sx Prop
Description
_input
Prop to style TextareaInput Component

TextareaInput

Contains all TextInput related layout style props and actions. It inherits all the properties of React Native's TextInput component.

Accessibility

We have outlined the various features that ensure the Textarea component is accessible to all users, including those with disabilities. These features help ensure that your application is inclusive and meets accessibility standards.

Keyboard

  • setting the aria-label and aria-hint

Screen Reader

  • VoiceOver: accessible and aria-label props to describe the input's purpose
  • aria-traits and aria-hint for the various states of the input, such as "double tap to edit"

Themed

The themed version of the component is a pre-styled version of the component, which allows you to quickly integrate the component into your project. The component's design and functionality are fully defined, allowing you to focus on the more important aspects of your project. To know more about Themed Library please visit this link.

Props

Textarea component is created using TextInput component from react-native. It extends all the props supported by React Native Text Input, utility props and the props mentioned below.

Textarea

Name
Value
Default
size
xl | lg | md | sm
md
Note: These props are exclusively applicable when utilizing the default configuration of gluestack-ui/config. If you are using a custom theme, these props may not be available.

Examples

The Examples section provides visual representations of the different variants of the component, allowing you to quickly and easily determine which one best fits your needs. Simply copy the code and integrate it into your project.

FormControl

The Textarea Component can be incorporated within the FormControl.
<FormControl>
<FormControlLabel>
<FormControlLabelText>Write with me</FormControlLabelText>
</FormControlLabel>
<Textarea>
<TextareaInput placeholder="Once upon a time..." />
</Textarea>
<FormControlHelper>
<FormControlHelperText>Start your story</FormControlHelperText>
</FormControlHelper>
</FormControl>

Unstyled

All the components in gluestack-ui are unstyled by default. To customize your UI using the extendedTheme, please refer to this link. The import names of components serve as keys to customize each component.

Spec Doc

Explore the comprehensive details of the Input in this document, including its implementation details, checklist, and potential future additions. Dive into the thought process behind the component and gain insights into its development journey.