# Aave Pro Textarea

A multi-line text field.

Build a Textarea in this project that looks and behaves like Aave Pro's. Measured from the running Aave Pro app (pro.aave.com). Keep every value exact. Map the tokens onto the project's own theme variables instead of hard-coding them. Use the project's own component library for behaviour, or Base UI primitives if it has none.

Fidelity: Partly measured from Aave Pro's input CSS. The minimum height is derived.

## Tokens

| Token | Light | Dark |
| --- | --- | --- |
| `--fg-4` | `#a8a8a8` | `#636161` |
| `--bg-2` | `#fcfcfc` | `#1a1919` |
| `--bg-3` | `#fff` | `#1f1e1e` |
| `--duration-snappy` | `0.22s` | `0.22s` |
| `--ease-shake` | `ease-out` | `ease-out` |
| `--duration-quick` | `0.1s` | `0.1s` |
| `--danger` | `#ff5147` | `#ff5147` |
| `--input-bg` | `transparent` | `transparent` |
| `--input-border` | `#00000014` | `#ffffff14` |
| `--input-border-hover` | `#0000001a` | `#ffffff1f` |
| `--input-text` | `#000` | `#fff` |
| `--font-regular` | `"Aave Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif` | `"Aave Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif` |
| `--font-size-small` | `0.875rem` | `0.875rem` |
| `--font-weight-normal` | `400` | `400` |
| `--radius-control` | `10px` | `10px` |

## CSS

Scoped under `[data-style="aave"]`; dark rules sit under `[data-theme="dark"]`. The `ui-*` classes and data attributes match the structure below.

```css
[data-style="aave"] {
  .ui-textarea {
    --input-ring: var(--input-border);

    box-sizing: border-box;
    display: block;
    width: 100%;
    min-height: 96px;
    margin: 0;
    padding: 12px;
    border: 0;
    border-radius: var(--radius-control);
    background-color: var(--input-bg);
    box-shadow: 0 0 0 1px var(--input-ring);
    color: var(--input-text);
    font-family: var(--font-regular);
    font-size: var(--font-size-small);
    font-weight: var(--font-weight-normal);
    line-height: 1.35;
    resize: vertical;
    outline: none;
    -webkit-font-smoothing: antialiased;
    transition:
      box-shadow var(--duration-quick),
      background-color var(--duration-quick);

    &::placeholder {
      color: var(--fg-4);
    }

    @media (hover: hover) {
      &:hover:not(:disabled, :focus-visible) {
        --input-ring: var(--input-border-hover);
      }
    }

    &:is(:focus, :focus-visible) {
      --input-ring: var(--input-border-hover);

      background-color: var(--bg-2);
    }

    &[aria-invalid="true"] {
      --input-ring: var(--danger);

      animation: aave-input-shake var(--duration-snappy) var(--ease-shake) both;
    }

    &:disabled {
      background-color: var(--bg-3);
      opacity: 0.6;
      cursor: not-allowed;
    }
  }

  .ui-textarea[data-variant="flat"] {
    min-height: 0;
    padding: 0;
    border-radius: 0;
    background-color: transparent;
    box-shadow: none;
    resize: none;

    @media (hover: hover) {
      &:hover:not(:disabled, :focus-visible) {
        box-shadow: none;
      }
    }

    &:is(:focus, :focus-visible) {
      background-color: transparent;
      box-shadow: none;
    }
  }
}
```

## Structure

How Replicas assembles it on Base UI.

```tsx
import type { ComponentProps } from "react";
import { join } from "./utils";

export type TextareaProps = ComponentProps<"textarea"> & {
  variant?: string;
  size?: string;
};

export function Textarea({ className, variant = "default", size, ...props }: TextareaProps) {
  return <textarea className={join("ui-textarea", className)} data-variant={variant} data-size={size} {...props} />;
}
```

## Example

```tsx
import { Textarea } from "@replicas/ui";

export default function TextareaDemo() {
  return <Textarea placeholder="Add a description…" rows={4} style={{ width: 320 }} aria-label="Description" />;
}
```

## Foundations

The rest of the Aave Pro style, as a skill: https://replicas.raphaelsalaja.com/skills/aave/SKILL.md