# ConversationApi (@salmonui/chat/conversation)

> The ConversationApi interface of @salmonui/chat/conversation.

Canonical: https://salmonui.dev/docs/reference/chat/conversation/ConversationApi

```ts
import type { ConversationApi } from '@salmonui/chat/conversation';
```

Entry index: https://salmonui.dev/docs/reference/chat/conversation (Markdown with every symbol of the entry: https://salmonui.dev/docs/reference/chat/conversation.md).

## Reference

Kind: interface

```ts
interface ConversationApi {
    scrollToBottom(options?: {
        readonly behavior?: ScrollBehavior;
    }): void;
    scrollToMessage(id: string, options?: {
        readonly focus?: boolean;
    }): boolean;
    focus(): void;
    send(text: string): void;
    stop(): void;
    regenerate(id: string): void;
    readonly element: HTMLDivElement | null;
}
```

Members (7):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `scrollToBottom` | `scrollToBottom(options?: {     readonly behavior?: ScrollBehavior; }): void;` |  | Scrolls to the latest message. |
| `scrollToMessage` | `scrollToMessage(id: string, options?: {     readonly focus?: boolean; }): boolean;` |  | Scrolls a message into view (mounted or virtualized) and returns whether it exists. |
| `focus` | `focus(): void;` |  | Focuses the composer input. |
| `send` | `send(text: string): void;` |  | Sends `text` as the current user (runs `onBeforeSend` and the adapter). |
| `stop` | `stop(): void;` |  | Aborts a pending adapter response. |
| `regenerate` | `regenerate(id: string): void;` |  | Assistant variant: runs the adapter again for response `id` and keeps the previous text as an alternative. |
| `element` | `readonly element: HTMLDivElement \| null;` |  | The root element. |
