Skip Navigation

Autosize Textarea

Auto resize textarea height based on content.

Installation

Run the following command

pnpm dlx @shadext/cli add autosize-textarea

Example

Max height

Ref

current max height from ref: 0

Form

Basic

"use client";
 
import { useState } from "react";
import { AutosizeTextarea } from "@/components/extension/autosize-textarea";
 
const AutosizeTextareaExample = () => {
  const [value, setValue] = useState("");
  return (
    <AutosizeTextarea
      value={value}
      onChange={(e) => setValue(e.target.value)}
    />
  );
};

Customize

This example demonstrates how to use the useAutosizeTextArea() hook to create a customizable textarea.