Skip to main content

Layout

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.

Design reviews

Install

Once per app, with Tailwind CSS v4 and an @/* path alias (Ouro HX is built on Base UI, so --base base; skip -t in an existing app):

npx shadcn@latest init --base base --preset nova --yes --no-monorepo
npx shadcn@latest add ourostack/ouro-ui/ouro-base#v1.3.258

Then the component. From v0.8.0 it installs only the helpers it imports and never touches your stylesheet (Installing):

npx shadcn@latest add ourostack/ouro-ui/thread-layout#v1.3.258

Or, with the @ouro namespace set up:

npx shadcn@latest add @ouro/ouro-base @ouro/thread-layout

Its tests, stories and Playwright spec are optional. They need Vitest 4.1.11 or later, and from v0.8.0 never change a version your app has (Testing):

npx shadcn@latest add ourostack/ouro-ui/thread-layout#v1.3.258 ourostack/ouro-ui/thread-layout-tests#v1.3.258
import { ThreadLayout } from "@/components/ouro/thread-layout/thread-layout";

Paths use shadcn's default @/ alias; the CLI rewrites them to yours.

Example

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

className
Type: string
Layout only: the box's size and margins. Appearance classes warn in development; the colors come from the theme.
conversation (required)
Type: 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
Type: string
Default: "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
Type: 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.