DocsComponentsTemplatesThemesGitHub

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.json

Guidelines

  • Set maxLength + showCount for limited fields. Sizes sm and md.

Props

PropTypeRequired
labelstringNo
hintReact.ReactNodeNo
errorReact.ReactNodeNo
requiredbooleanNo
optionalbooleanNo
maxLengthnumberNo
showCountbooleanNo
rowsnumberNo
size'sm' | 'md'No

Also accepts everything in Omit<React.TextareaHTMLAttributes<HTMLTextAreaElement>, 'size'>.

Edit this example on GitHub