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

# ThreadLayout

A conversation beside its thread. From 32rem up the conversation takes the rest of the width and the thread its own 20rem. Below that, an open thread takes the whole box and the conversation is hidden, not unmounted. The widths follow the layout's own box, not the window.

```tsx
import { ThreadLayout } from "@/components/ouro/thread-layout/thread-layout";
```

## Example

```tsx
<ThreadLayout
  conversation={<MessageList label="Messages">{messages}</MessageList>}
  thread={open ? <ThreadRail label="Thread" onClose={closeThread}><MessageList label="Replies">{replies}</MessageList></ThreadRail> : null}
/>
```

## Usage

When a thread that holds focus closes, focus goes back to the control in the conversation that opened it. When none did (a thread opened from a link, or its opener gone since), focus comes to the conversation's heading, or else to the conversation pane itself, a region named by `conversationLabel`, so focus never falls to the page.

Use `ThreadRail` for the thread itself.

## Use instead when

- Use `Sheet` instead when the thread should cover the page as a modal panel, and `Resizable` instead when the person sizes the panes.

## Props

Type: `ThreadLayoutProps`.

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `className` | `string` |  | Layout only: the box's size and margins. Appearance classes warn in development; the colors come from the theme. |
| `conversation` (required) | `ReactNode` |  | The main pane: the list and its reply box. It stays mounted while a thread covers it, so its scroll position and its draft stay. |
| `conversationLabel` | `string` | `"Conversation pane"` | The conversation pane's name, which a screen reader hears when focus comes to the pane: when a thread closes that no control in the conversation opened and the conversation has no heading to take focus. Name it apart from the MessageList inside it, which is a region too. Translate it with the rest of your interface. |
| `thread` | `ReactNode` |  | The thread, usually a `ThreadRail`. Pass `null` when no thread is open, and the conversation takes the whole box. |

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

- `rail`: Not a prop. The thread is `thread`: `<ThreadLayout conversation={list} thread={open ? <ThreadRail …/> : null} />`.

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