Componentform0.45 KB gzipZero dependencies

Textarea Autosize

Auto-growing textarea with min/max height bounds.

Preview

Live Preview
Open ↗

Installation

Tokens guide →

Add to your project via CLI (zero dependencies, code you own):

npx bigbullui add textarea-autosize

Or install the full npm package:

npm install bigbullui

Usage

tsx3 lines
import { TextareaAutosize } from "@/components/ui/textarea-autosize"; <TextareaAutosize />

Source code

textarea-autosize.tsx + 1 helper

Zero third-party dependencies (2 local files shown in tabs below).

tsxtextarea-autosize.tsx44 lines
"use client"; import * as React from "react";import { cn } from "./lib/utils"; export interface TextareaAutosizeProps extends React.TextareaHTMLAttributes<HTMLTextAreaElement> {  minHeight?: number;  maxHeight?: number;} /** Auto-resizing textarea that expands with user input content. */export function TextareaAutosize({ minHeight = 60, maxHeight = 300, className, ...props }: TextareaAutosizeProps) {  const ref = React.useRef<HTMLTextAreaElement>(null);   const resize = () => {    const el = ref.current;    if (!el) return;    el.style.height = "auto";

Props

Interactive Prop Playground

Tweak parsed AST props below to generate ready-to-paste JSX.

tsx3 lines
import { TextareaAutosize } from "@/components/ui/textarea-autosize"; <TextareaAutosize />
PropTypeDescription
minHeightnumberConfigures min height. (Default: 60)
maxHeightnumberConfigures max height. (Default: 300)