Autosize Textarea

Auto resize textarea height based on content.

Installation

1

Paste this code into your project

2

Update import paths as needed

Usage

Max height

ref

current max height from ref: 0

Form

Customize

This is an example that you can use the hook useAutosizeTextArea() to create your own textarea to match your needs.

In this example, we use react-hook-form and shadcn-ui Textarea to fully control your customize textarea.

Spectrum Pro

Stop building from scratch.
Ship faster with Pro templates.

Premium Next.js templates built on Spectrum UI. Dark. Animated. Production-ready.