Textarea
Multi-line input with sizes, required/optional, error and character count.
Code
import * as React from 'react';
import { Textarea } from '@fruit-labs/design';
export default function Demo() {
return (
<div
style={{
maxWidth: 420,
}}
>
<Textarea
label="Description"
optional
placeholder="What is this project about?"
maxLength={280}
showCount
/>
</div>
);
}Character count
import { Textarea } from '@fruit-labs/design';
export default function Example() {
return (
<div style={{ display: 'flex', flexDirection: 'column', gap: 12, maxWidth: 560 }}>
<Textarea label="Bio" maxLength={160} showCount hint="Shown on your profile." />
</div>
);
}Install
From npm:
npm install @fruit-labs/design
import { Textarea } from '@fruit-labs/design';Or copy the TypeScript source into your project:
npx shadcn@latest add https://design.fruitlabs.online/r/textarea.jsonGuidelines
- Set
maxLength+showCountfor limited fields. Sizes sm and md.
Props
| Prop | Type | Required |
|---|---|---|
label | string | No |
hint | React.ReactNode | No |
error | React.ReactNode | No |
required | boolean | No |
optional | boolean | No |
maxLength | number | No |
showCount | boolean | No |
rows | number | No |
size | 'sm' | 'md' | No |
Also accepts everything in Omit<React.TextareaHTMLAttributes<HTMLTextAreaElement>, 'size'>.