# ThreadList

Search, open, rename and archive conversations.

- **Use it for**: Searching, selecting, renaming and archiving conversations.
- **Not for**: Branches within one conversation. Try [BranchSwitcher](https://unseenui.com/components/branch-switcher/).

## Good to know

- Compact rows are 36px with 1px between them, and showing their actions never changes a row’s height.
- In a sidebar that scrolls, set `--ai-navigation-height: none` and `--ai-navigation-gutter: auto` so the list grows instead of scrolling inside it; `--ai-list-inset` lines rows up with your navigation.

## Installation

```bash
npm install @stackunseen/ui
```

## Usage

```tsx
import { ThreadList } from '@stackunseen/ui';
import '@stackunseen/ui/styles.css';

<ThreadList variant="list" threads={threads} query={query} onQueryChange={setQuery} onSelect={openThread} />
```

## All props

| Prop | Type | Description |
| --- | --- | --- |
| `actions` | `ReactNode` | Controls beside the list title, such as a New chat button. |
| `className` | `string` | Added to the root element, after the component's own classes. |
| `connection` | `"unknown" \| ConnectionState` |  |
| `context` | `ConversationContext` |  |
| `error` | `string` |  |
| `groupBy` | `"none" \| "date"` | "date" groups threads into Pinned, Today, Yesterday, Previous 7 days, Previous 30 days and Earlier, from each thread's updatedAt. |
| `label` | `string` |  |
| `loading` | `boolean` |  |
| `now` | `string` | The host clock for date groups (ISO 8601), so server and browser agree. |
| `onArchive` | `((thread: ThreadSummary) => void)` |  |
| `onLoadMore` | `(() => void)` |  |
| `onPageChange` | `((pageIndex: number) => void)` |  |
| `onQueryChange` | `((value: string) => void)` |  |
| `onReconcile` | `((operation: NavigationOperation) => void)` |  |
| `onRename` | `((thread: ThreadSummary, title: string) => void)` |  |
| `onRequestArchive` | `((request: ThreadSelectionRequest) => void)` |  |
| `onRequestPage` | `((request: ConversationPageRequest) => void)` |  |
| `onRequestRename` | `((request: ThreadRenameRequest) => void)` |  |
| `onRequestSearch` | `((request: ConversationSearchRequest) => void)` |  |
| `onRequestSelect` | `((request: ThreadSelectionRequest) => void)` |  |
| `onScrollOffsetChange` | `((offset: number) => void)` |  |
| `onScrollSnapshotChange` | `((snapshot: ConversationScroll) => void)` |  |
| `onSelect` | `((thread: ThreadSummary) => void)` |  |
| `operation` | `NavigationOperation` |  |
| `pagination` | `ConversationPagination` |  |
| `query` (required) | `string` |  |
| `rowActions` | `((thread: ThreadSummary) => ReactNode)` | Extra per-thread controls, such as a menu with Share or Move, after Rename and Archive. |
| `scrollOffset` | `number` |  |
| `scrollRestoration` | `ConversationScroll` |  |
| `searchable` | `boolean` | false leaves out the search box, for a sidebar that searches somewhere else, such as a "Search chats" dialog. |
| `selectedId` | `string` |  |
| `status` | `NavigationAvailability` |  |
| `threads` (required) | `readonly ThreadSummary[]` | Complete bounded host window, at most 100 unique rows. |
| `variant` | `"list" \| "cards" \| "compact"` |  |

## Keyboard

Tab reaches controls; Enter or Space activates buttons. Accordions use arrow keys, Home and End. Select menus support arrows and typeahead; Escape closes menus and dialogs and restores focus.

## Works with

[Reasoning](https://unseenui.com/components/reasoning/), [SuggestTextarea](https://unseenui.com/components/suggest-textarea/), [Checkpoint](https://unseenui.com/components/checkpoint/), [SlashCommandMenu](https://unseenui.com/components/slash-command-menu/), [BranchSwitcher](https://unseenui.com/components/branch-switcher/), [MessageQueue](https://unseenui.com/components/message-queue/), [PromptInput](https://unseenui.com/components/prompt-input/), [Message](https://unseenui.com/components/message/), [MessageActions](https://unseenui.com/components/message-actions/), [StreamingResponse](https://unseenui.com/components/streaming-response/), [Suggestions](https://unseenui.com/components/suggestions/), [FollowUps](https://unseenui.com/components/follow-ups/)

Page: https://unseenui.com/components/thread-list/
