# PromptInput

> Where a question is written. The field grows with the text up to a limit; ⌘↵ or Ctrl↵ sends and ↵ keeps a new line. While a reply streams the send button is a stop button. Suggestions above it send with a click. No model and no network: it hands the text to onSubmit.

Section: Chat. Docs: https://entrepta.vercel.app/docs/components/prompt-input

## Install

```bash
npx @entrepta/cli@latest add prompt-input
```

Files: `primitives/prompt-input.tsx`, `primitives/button.tsx`, `primitives/button-variants.ts`, `primitives/kbd.tsx`.
npm packages: `class-variance-authority`, `@phosphor-icons/react`, `@radix-ui/react-slot`.
Comes with: `button`, `kbd`.

## Usage

```tsx
import { PromptInput } from "@/components/entrepta/prompt-input"

<PromptInput
  onSubmit={send}
  streaming={busy}
  onStop={stop}
  suggestions={["Spending this month", "Biggest category"]}
  tools={<Button variant="ghost" size="icon-sm" aria-label="Attach">…</Button>}
/>
```

## Props

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `onSubmit` | `(text) => void` | - | Trimmed; an empty one never goes |
| `value, defaultValue, onValueChange` | `string` | - | Controlled or not |
| `streaming, onStop` | `boolean, () => void` | - | Send becomes stop |
| `suggestions` | `string[]` | - | A click sends one |
| `tools` | `ReactNode` | - | Buttons on the left of the toolbar |
| `maxHeight` | `number` | 200 | Tallest before it scrolls |
| `label` | `string` | "Message" | The field's name |
