# V textarea 8

> Auto-grow with live word and character count

A shadcn/ui block from the [@cnippet](https://ui.cnippet.dev/) registry, listed on [shadcn.exchange](https://shadcn.exchange/r/cnippet/v-textarea-8).

- Page, with a live preview: https://shadcn.exchange/r/cnippet/v-textarea-8
- Screenshot: https://abzjhwgwpdpz7ua5.public.blob.vercel-storage.com/shots/cnippet/v-textarea-8-light-bfb9b4cac151b939.png
- Registry item: https://ui.cnippet.dev/r/v-textarea-8.json
- Categories: textarea
- Listed: 2026-10-13, source last changed 2026-10-13

## Install

```bash
npx shadcn@latest add https://ui.cnippet.dev/r/v-textarea-8.json
```

Run it in a project that has shadcn/ui set up. It adds the files below and installs what they depend on.

## Dependencies

- Registry items: `@cnippet/textarea`

## Files

### `registry/default/variants/v-textarea-8.tsx`

```tsx
"use client";

import { useState } from "react";
import { Textarea } from "@/registry/default/ui/textarea";

export function Pattern() {
  const [value, setValue] = useState("");
  const wordCount = value.trim() ? value.trim().split(/\s+/).length : 0;
  const charCount = value.length;

  return (
    <div className="w-full max-w-xs">
      <Textarea
        onChange={(e) => setValue(e.target.value)}
        placeholder="Start writing. The field grows as you type…"
        value={value}
      />
      <div className="mt-1.5 flex items-center justify-between text-muted-foreground text-xs">
        <span>
          {wordCount} {wordCount === 1 ? "word" : "words"}
        </span>
        <span>{charCount} chars</span>
      </div>
    </div>
  );
}
```
