Lunar Kit LogoLunar Kit
Components

Textarea

A multi-line text input field for longer content.

Demo
Code

Installation

lunar add textarea

Usage

import { Textarea } from '@/components/ui/textarea';

Basic Usage

const [value, setValue] = useState('');
 
<Textarea
value={value}
onChangeText={setValue}
placeholder="Enter your message..."
/>

With Label

<Textarea
label="Description"
value={description}
onChangeText={setDescription}
placeholder="Enter a description..."
/>

With Error

<Textarea
label="Bio"
value={bio}
onChangeText={setBio}
error="Bio is required"
/>

Custom Rows

// Small (2 rows)
<Textarea rows={2} placeholder="Short input..." />
 
// Medium (4 rows - default)
<Textarea rows={4} placeholder="Default size..." />
 
// Large (8 rows)
<Textarea rows={8} placeholder="Larger input..." />

Disabled State

<Textarea
label="Notes"
value="This cannot be edited"
editable={false}
/>

Character Count

export function TextareaWithCount({ maxLength = 280 }) {
const [value, setValue] = useState('');
 
return (
  <View className="gap-1">
    <Textarea
      value={value}
      onChangeText={setValue}
      placeholder="What's on your mind?"
      maxLength={maxLength}
    />
    <Text
      variant="muted"
      size="sm"
      align="right"
      className={value.length >= maxLength ? 'text-destructive' : ''}
    >
      {value.length}/{maxLength}
    </Text>
  </View>
);
}

API Reference

Textarea

PropTypeDefaultDescription
labelstringInput label
errorstringError message
rowsnumber4Number of visible lines
containerClassNamestringClasses for container
classNamestringClasses for textarea

On this page