# Open in chat

Hand the current prompt, page or answer to another assistant, with the prompt shown before it leaves.

Example: Open in chat. A docs page offers to continue the question in the reader's own assistant. Preview: https://chatcn.dev/preview/open-in-chat-demo

## Installation

```bash
npx shadcn@latest add https://chatcn.dev/r/open-in-chat.json
```

## Usage

```tsx
import { OpenInChat } from "@/components/ui/chatcn/open-in-chat"

<OpenInChat query={`Read ${pageUrl} and explain how to rotate a signing secret.`} />
```

The menu lists assistants that accept a prompt in their address (ChatGPT, Claude, Perplexity, T3 Chat and v0 by default), each opening a new tab with the prompt in place, plus Copy prompt for anything else. Assistants are listed by name: chatcn ships no third party logos, so pass your own marks through each provider's `icon`. The prompt is shown at the top of the menu, so nobody wonders what leaves the page. Replaces AI Elements' Open In Chat.

## Examples

### States

Example: States. Ghost and subtle triggers, a short provider list, and disabled. Preview: https://chatcn.dev/preview/open-in-chat-states

## Props

| Prop | Type | Notes |
| --- | --- | --- |
| `query` | `string` | The prompt handed over |
| `providers` | `ChatProvider[]` | `{ id, name, href(query), icon? }`. Defaults to `chatProviders` |
| `variant`, `size`, `align` |  | The trigger's look and the menu's side |
| `onOpen`, `onCopy` |  |  |
| `disabled` | `boolean` |  |
| `labels` | `Partial<OpenInChatLabels>` | Every string, for translation |

## Keyboard

| Key | Action |
| --- | --- |
| Enter or Space on the trigger | Open the menu |
| Arrow keys, Enter | Choose an assistant |

## Accessibility

- Each assistant says it opens in a new tab.
- Copy prompt announces Copied politely.

Source: https://chatcn.dev/docs/components/open-in-chat