Componentform0.45 KB gzipZero dependencies
Textarea Autosize
Auto-growing textarea with min/max height bounds.
Preview
Live Preview
Installation
Tokens guide →Add to your project via CLI (zero dependencies, code you own):
npx bigbullui add textarea-autosizeOr install the full npm package:
npm install bigbulluiUsage
tsx3 lines
import { TextareaAutosize } from "@/components/ui/textarea-autosize"; <TextareaAutosize />Source code
textarea-autosize.tsx + 1 helperZero 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 />| Prop | Type | Description |
|---|---|---|
| minHeight | number | Configures min height. (Default: 60) |
| maxHeight | number | Configures max height. (Default: 300) |