Share ConversationPRO
Share a chat: pick who can view, watch the link type itself in, copy it, and preview what viewers will see.
Code
3 files · 696 lines of TypeScriptPRO
Share Conversation is part of Pro
Get its source, the one-paste agent prompt and all 113 components, for a one-time $99.
Motion notes
- Visibility is a Model Switcher, so the pill glides between Private and Anyone with link. The description under the title swaps with it, saying exactly who can see the chat.
- Switching to a link folds the field open on the layout spring, and the URL types itself in character by character, so it reads as freshly generated rather than pasted.
- The preview card is the conversation as a viewer will see it. While private it dims and blurs under a Private badge; turning attachments off folds their chips away.
- Copy morphs its icon into a drawn check and its label into “Copied”, announced by a polite live region. The dialog traps focus, closes on Escape or backdrop, and returns focus. With reduced motion, the link appears whole and panels fade.
Usage
Example
<ShareDialog
open={open}
onOpenChange={setOpen}
conversation={{ title: chat.title, messages: chat.messages, meta: "14 messages · Today", attachments: ["roadmap.pdf"] }}
visibility={share.visibility}
onVisibilityChange={(v) => updateShare(chat.id, v)}
link={share.url}
/>Props
| Prop | Type | Default | Description |
|---|---|---|---|
| conversation | { title, messages, meta?, attachments? } | — | messages: { role: "user" | "assistant", text }[] (the first two are previewed). attachments: file names; shows the switch when present. |
| open | boolean | — | Controlled open state. |
| defaultOpen | boolean | false | Initial open state when uncontrolled. |
| onOpenChange | (open: boolean) => void | — | Called on close (Done, X, backdrop, Escape). |
| inline | boolean | false | Renders inside the nearest positioned parent instead of a fixed portal. Use for previews. |
| visibility | "private" | "link" | — | Controlled visibility. |
| defaultVisibility | "private" | "link" | "private" | Initial visibility when uncontrolled. |
| onVisibilityChange | (visibility) => void | — | Called when visibility changes. Create or revoke the link here. |
| link | string | — | The public URL. While undefined in link mode, the field shows “Creating link…”. |
| includeAttachments | boolean | — | Controlled attachments switch. |
| defaultIncludeAttachments | boolean | true | Initial attachments switch when uncontrolled. |
| onIncludeAttachmentsChange | (include: boolean) => void | — | Called when the switch changes. |
| copied | boolean | — | Controlled copied state. Otherwise it shows for 1.6s after a successful copy. |
| onCopy | (link: string) => void | — | Called when Copy is pressed. |
| title | string | "Share conversation" | Heading and the dialog's accessible name. |
| className | string | — | Classes for the dialog panel. |