Thinking UI

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

PropTypeDefaultDescription
conversation{ title, messages, meta?, attachments? }—messages: { role: "user" | "assistant", text }[] (the first two are previewed). attachments: file names; shows the switch when present.
openboolean—Controlled open state.
defaultOpenbooleanfalseInitial open state when uncontrolled.
onOpenChange(open: boolean) => void—Called on close (Done, X, backdrop, Escape).
inlinebooleanfalseRenders 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.
linkstring—The public URL. While undefined in link mode, the field shows “Creating link…”.
includeAttachmentsboolean—Controlled attachments switch.
defaultIncludeAttachmentsbooleantrueInitial attachments switch when uncontrolled.
onIncludeAttachmentsChange(include: boolean) => void—Called when the switch changes.
copiedboolean—Controlled copied state. Otherwise it shows for 1.6s after a successful copy.
onCopy(link: string) => void—Called when Copy is pressed.
titlestring"Share conversation"Heading and the dialog's accessible name.
classNamestring—Classes for the dialog panel.