HextaUI

Textarea: Rows

minRows and maxRows set where growing starts and stops.

import { Textarea } from "@/components/ui/textarea"

export function TextareaRows() {
  return (
    <div className="grid w-full max-w-md gap-4 sm:grid-cols-2">
      <Textarea
        aria-label="One to four rows"
        minRows={1}
        maxRows={4}
        placeholder="1–4 rows"
      />
      <Textarea
        aria-label="Five to fifteen rows"
        minRows={5}
        maxRows={15}
        placeholder="5–15 rows"
      />
    </div>
  )
}

This adds the example as components/examples/textarea/rows.tsx, together with the Textarea component and the HextaUI theme tokens it needs.

pnpm dlx shadcn@latest add https://hextaui.com/r/textarea-rows.json

To add only the component, follow the Textarea installation.

Props in this example

The Textarea props this example sets, from the API reference.

PropTypeDefault
minRows
number3
maxRows
number10

Every prop is in the Textarea API reference.

See them all, with keyboard support and accessibility notes, on the Textarea page.