component. -->
Demo
Shows an textarea component.
npx @react-native-reusables/cli@latest add textarea
Copy/paste the following code to ~/components/ui/textarea.tsx
~/components/ui/textarea.tsx
import * as React from 'react';import { TextInput, type TextInputProps } from 'react-native';import { cn } from '~/lib/utils'; const Textarea = React.forwardRef<React.ElementRef<typeof TextInput>, TextInputProps>( ({ className, multiline = true, numberOfLines = 4, placeholderClassName, ...props }, ref) => { return ( <TextInput ref={ref} className={cn( 'web:flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-base lg:text-sm native:text-lg native:leading-[1.25] text-foreground web:ring-offset-background placeholder:text-muted-foreground web:focus-visible:outline-none web:focus-visible:ring-2 web:focus-visible:ring-ring web:focus-visible:ring-offset-2', props.editable === false && 'opacity-50 web:cursor-not-allowed', className )} placeholderClassName={cn('text-muted-foreground', placeholderClassName)} multiline={multiline} numberOfLines={numberOfLines} textAlignVertical='top' {...props} /> ); }); Textarea.displayName = 'Textarea'; export { Textarea };
import { Textarea } from '~/components/ui/textarea';import { Text } from '~/components/ui/text'; function Example() { const [value, setValue] = React.useState(''); return ( <Textarea ref={inputRef} placeholder='Write some stuff...' value={value} onChangeText={setValue} aria-labelledby='textareaLabel' /> );}
Extends Text Input props
Text Input