# Textarea

shadcn textarea as a sunken 1-bit field that grows with its content.

Source: https://www.ui95.dev/ui/textarea

## Examples

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

import type { ShowcaseDemo } from "../types"

export const demo: ShowcaseDemo = {
  span: "single",
  variants: [
    {
      label: "default",
      render: () => <Textarea defaultValue={"Dear diary,\nThe printer jammed again."} aria-label="Diary" />,
    },
    { label: "placeholder", render: () => <Textarea placeholder="Leave a note" aria-label="Note" /> },
    { label: "disabled", render: () => <Textarea disabled defaultValue="Locked" aria-label="Locked" /> },
    { label: "invalid", render: () => <Textarea aria-invalid defaultValue="???" aria-label="Invalid" /> },
  ],
}
```

## Installation

```bash
npx shadcn@latest add https://www.ui95.dev/r/textarea.json
```

Run it in a Radix shadcn project that already has the UI95 theme.

Dependencies:

```bash
npm install cn
```

`components/ui/textarea.tsx`

```tsx
import { cn } from "cn"
import * as React from "react"

function Textarea({ className, ...props }: React.ComponentProps<"textarea">) {
  return (
    <textarea
      data-slot="textarea"
      className={cn(
        "flex field-sizing-content min-h-24 w-full pixel-border bg-input text-foreground border-border well px-2 py-1.5 text-xl leading-tight placeholder:text-well-muted disabled:cursor-not-allowed disabled:bg-muted disabled:text-muted-foreground aria-invalid:border-dashed aria-invalid:border-destructive",
        className
      )}
      {...props}
    />
  )
}

export { Textarea }
```

## API reference

### Textarea

No props of its own. It forwards the props of the element or primitive it wraps.

## Used by

- [input-group](https://www.ui95.dev/ui/input-group)

## Sounds

- `typewriter.key`
- `typewriter.space`
- `typewriter.return`
