# SuggestTextarea

A text area that shows an AI completion as ghost text; Tab accepts it.

- **Use it for**: Writing where an AI suggests how the sentence continues.
- **Not for**: A chat composer that sends on Enter. Try [PromptInput](https://unseenui.com/components/prompt-input/), [Textarea](https://unseenui.com/components/textarea/).

## Installation

```bash
npm install @stackunseen/ui
```

## Usage

```tsx
import { SuggestTextarea } from '@stackunseen/ui/assistant';
import '@stackunseen/ui/styles.css';

<SuggestTextarea value={draft} onValueChange={setDraft} suggestion={completion} />
```

## All props

| Prop | Type | Description |
| --- | --- | --- |
| `onAccept` | `((value: string) => void)` | Called with the new value after Tab accepts the suggestion. |
| `onDismiss` | `(() => void)` | Called when Escape dismisses the suggestion; stop showing it until the text changes. |
| `onValueChange` (required) | `(value: string) => void` |  |
| `suggestion` | `string` | Text that would follow the current value, from your completion model. |
| `value` (required) | `string` |  |

## Keyboard

Tab accepts and Escape dismisses only while a suggestion shows at the end of the text; otherwise both keep their usual behavior. Screen readers hear the suggestion as a description.

## Works with

[Reasoning](https://unseenui.com/components/reasoning/), [Checkpoint](https://unseenui.com/components/checkpoint/), [SlashCommandMenu](https://unseenui.com/components/slash-command-menu/), [ThreadList](https://unseenui.com/components/thread-list/), [BranchSwitcher](https://unseenui.com/components/branch-switcher/), [MessageQueue](https://unseenui.com/components/message-queue/), [PromptInput](https://unseenui.com/components/prompt-input/), [Message](https://unseenui.com/components/message/), [MessageActions](https://unseenui.com/components/message-actions/), [StreamingResponse](https://unseenui.com/components/streaming-response/), [Suggestions](https://unseenui.com/components/suggestions/), [FollowUps](https://unseenui.com/components/follow-ups/)

Page: https://unseenui.com/components/suggest-textarea/
