# Share thread

Share a thread: who can open it, and where the shared copy ends (so later messages aren't shared by accident). The audiences and what each one sees come from the service; the first is "not shared".

- Registry name: `share-thread` (`@candor/share-thread`)
- Tier: Pro. Installing it needs a Pro, Premium or Team licence key: the person runs `npx candor-ui key <key>` themselves; never ask for the key in chat or write it to a file.
- Docs: https://candor.themethodic.com/docs/share-thread

## Install

```bash
npx candor-ui add share-thread
```

Run `npx candor-ui@latest init` once first (https://candor.themethodic.com/get-started.md). Without the CLI: `npx shadcn@latest add @candor/share-thread`.
It brings in: button, locale, utils.
npm packages: lucide-react@^1.67.0.

## Example

```tsx
"use client"

import { ShareThread, type ShareAudience } from "@/components/share-thread"

const audiences: ShareAudience[] = [
  { id: "private", label: "Only me", detail: "Nobody else can open it" },
  { id: "team", label: "Acme’s software team", detail: "Members can read it and reply" },
  { id: "link", label: "Anyone at Acme with the link", detail: "Read only; tool output is hidden" },
]

export default function Example() {
  return <ShareThread className="max-w-md" audiences={audiences} messageCount={14} onShare={() => {}} />
}
```

## <ShareThread>

Props:

- `audiences: ShareAudience[]`: The first audience means "not shared".
- `initial?: string | undefined`: The audience selected when it opens. Defaults to the first, not shared.
- `messageCount: number`: How many messages the thread has; the share point can be set anywhere up to it.
- `onShare: (audienceId: string, upTo: number) => void`: Called with the chosen audience and the last message number to share (1-based). The first audience's id means stop sharing.
- `className?: string | undefined`

## Strings (`shareThread`)

The fixed words, English by default. Override any of them under `shareThread` in `<LocaleProvider strings={{ shareThread: { … } }}>`; the table is exported as `shareThreadStrings`.

- `shareThread`: Share thread
- `whoCanOpen`: Who can open it
- `shareUpTo`: Share up to
- `messageOf`: message {upTo} of {count}
- `laterShared`: Later messages are shared as they arrive.
- `afterPrivate`: Messages after this one stay private.
- `stopSharing`: Stop sharing
- `copyLink`: Copy link

## Types

### ShareAudience

```ts
{ id: string; label: string; detail: string }
```

## Rules for using Candor UI

- Components take plain typed data. Never pass model output as HTML or render it as a link; messages are typed blocks.
- A control that can't be used says why: wrap it in `<Locked reason="…">`, don't just disable it.
- Don't show a value you don't have: leave it out (it renders as —) rather than guess. An estimate is labelled as one.
- Nothing is pre-selected in a decision a person makes, and the agent is named from your app's data, never from model output.
- Your app's words go in `LocaleProvider` (fixed strings) and `TermsProvider` (nouns); entity kinds and agent roles in `EntityKindsProvider` and `AgentRolesProvider`.
