# Thread header

The bar above a thread: its title, the environment it acts on, and who is working on it right now. Agent status is ambient — avatars of the agents at work and a count — so a person can tell at a glance whether anything is running.

- Registry name: `thread-header` (`@candor/thread-header`)
- 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/thread-header

## Install

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

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

## Example

```tsx
"use client"

import { Share2 } from "lucide-react"
import { ThreadHeader } from "@/components/thread-header"
import type { AgentIdentity } from "@/lib/chat"

const working: AgentIdentity[] = [
  { id: "a-dev", name: "Dev agent", role: "dev" },
  { id: "a-qa", name: "QA agent", role: "qa" },
]

export default function Example() {
  return (
    <div className="max-w-2xl overflow-hidden rounded-lg border">
      <ThreadHeader
        title="Add a region column to orders"
        scope={{ account: "Acme", environment: "Storefront", detail: "staging", production: false }}
        working={working}
        actions={
          <button type="button" aria-label="Share thread" className="flex size-8 items-center justify-center rounded-md text-muted-foreground hover:bg-accent hover:text-foreground">
            <Share2 className="size-4" />
          </button>
        }
      />
    </div>
  )
}
```

## <ThreadHeader>

Props:

- `title: string`: The thread's name.
- `scope?: ComposerScope | undefined`: The environment the thread acts on, shown as a tag; production shows a warning. Without one, no tag.
- `working?: AgentIdentity[] | undefined` (default `[]`): Agents currently running on this thread.
- `actions?: React.ReactNode | undefined`: Buttons at the right end, e.g. share or close.
- `className?: string | undefined`

## Strings (`threadHeader`)

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

- `production`: Production
- `nonProduction`: Non-production
- `agentsWorking`: { one: "{count} agent working: {names}", other: "{count} agents working: {names}" }
- `working`: {count} working
- `idle`: Idle

## 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`.
