<!-- Generated by scripts/gen-docs.mts from the JSDoc in registry/. Do not edit; run `pnpm run docs`. -->

# ConversationFind

The find bar for a conversation: a box with previous and next buttons, the match's place ("2 of 5") and a close button. Enter and Shift+Enter in the box step to the next and previous match, F3 and Shift+F3 and Cmd+G or Ctrl+G with Shift do the same from anywhere on the page while the bar is open, and Escape closes it and puts focus back where it was before the bar opened. A step never moves focus out of the box; the list brings the current match into view. The place is a polite status announced once per change. The bar draws and counts nothing itself: pass what a MessageList's `onFindMatches` reports as `count` and `current`, and `query` and `current` back to its `find` prop.

## Install

Once per app, with Tailwind CSS v4 and an `@/*` path alias (skip `init` in an existing shadcn app), then the component:

```sh
npx shadcn@latest init --base base --preset nova --yes --no-monorepo
npx shadcn@latest add ourostack/ouro-ui/ouro-base#v1.3.823
npx shadcn@latest add ourostack/ouro-ui/conversation-find#v1.3.823
```

More: [Installing](https://ui.ouroboros.bot/docs/installing.md).

```tsx
import { ConversationFind } from "@/components/ouro/conversation-find/conversation-find";
```

## Example

```tsx
<ConversationFind label="Find in conversation" query={query} onQueryChange={setQuery} count={report.count} current={report.current} onCurrentChange={setCurrent} onClose={() => setOpen(false)} />
```

## Usage

Use MessageList's own `find` for the highlighting and the count; use ConversationFind for the box that drives it.

## Use instead when

- Use TextField `type="search"` instead when the search is for a list of things and not for the text of one conversation.

## Props

Type: `ConversationFindProps`.

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `className` | `string` |  | Layout only: margins, width, grid placement (`mt-2`, `w-full`). Appearance classes warn in development. |
| `closeLabel` | `string` | `"Close find"` | The name of the close button, as visually hidden text. |
| `count` (required) | `number` |  | How many matches there are: the `count` a MessageList reports through `onFindMatches`. |
| `current` (required) | `number \| null` |  | The index of the current match, or null when the list has not found one: pass it to the list's `find={{ current }}` too. |
| `label` (required) | `string` |  | What the bar finds in, for screen readers: "Find in conversation". It names the bar's region and its box. Required, so both have a name. |
| `nextLabel` | `string` | `"Next match"` | The name of the next button, as visually hidden text. |
| `noMatchesLabel` | `string` | `"No matches"` | What the bar and its announcement say for a search without a match. |
| `onClose` (required) | `() => void` |  | Called when the reader closes the bar with Escape or its close button. Put focus back and stop passing `find` to the list. |
| `onCurrentChange` (required) | `(current: number) => void` |  | Called with the match a step lands on (Enter, F3, the buttons). It wraps round past either end. |
| `onQueryChange` (required) | `(query: string) => void` |  | Called with what the reader typed. |
| `partial` | `boolean` | `false` | True while more matches may lie in history not loaded yet (the report's `partial`): the count reads as a lower bound, "2 of 5+". |
| `placeholder` | `string` | `"Find"` | The name of the box's text, as a placeholder. |
| `previousLabel` | `string` | `"Previous match"` | The name of the previous button, as visually hidden text. |
| `query` (required) | `string` |  | What is typed in the box. The bar is controlled: keep it in state and pass it to the list's `find={{ query }}`. |
| `ref` | `Ref<HTMLDivElement>` |  | The bar's `<div>`. |
| `resultLabel` | `((current: number, count: number) => string)` |  | What the bar and its announcement say for the current match: `(2, 5)` is "2 of 5". Translate it with your app. |

## Native attributes

Also accepts the attributes in React's `HTMLAttributes` (`id`, `aria-*`, event handlers), passed to the rendered element, except those named on this page.

## Don't use

These are not props. Passing one fails the type check with the fix in the error, and in development a console message names the fix.

- `onNext`: Not a prop. Ouro UI uses `onCurrentChange`.
- `onSearch`: Not a prop. Ouro UI uses `onQueryChange`.
- `value`: Not a prop. Ouro UI uses `query`: `<ConversationFind query={query} />`.

## `className` is for layout only

Pass margins, width and grid placement (`mt-4`, `w-full`, `col-span-2`).

Appearance comes from props, not classes. In development, a class that sets appearance logs one warning per component instance, naming the prop to use instead. A class sets appearance when, after its variants (`hover:`, `sm:`) and any `!` are removed, it starts with `bg-`, `text-`, `border-`, `rounded-`, `shadow-`, `font-`, `ring-`, `from-`, `via-`, `to-`, `fill-` or `stroke-`, or is `border`, `rounded`, `shadow` or `ring`, or has a `dark:` variant. Text wrapping, overflow and table layout classes (`text-wrap`, `text-ellipsis`, `border-collapse`) are layout and do not warn.

Alignment classes (`text-center`) warn too: set alignment on a parent element.
