# Post Thread

> Posts that answer one another, in order, joined by a line between their avatars.

```tsx
'use client';

import { PostThread, SocialPost } from '@brand-studio/ui';
import { cup } from '@/demos/assets';

const still = { name: 'Still Coffee', handle: 'stillcoffee', verified: true };

export default function PostThreadDemo() {
  return (
    <div style={{ width: '100%', maxWidth: 560 }}>
      <PostThread label="Brewing the Huila lot">
        <SocialPost author={still} time="3h" replies={6} reposts={14} likes={312}>Two changes for the Huila lot, from this morning's cupping.</SocialPost>
        <SocialPost author={still} time="3h" replies={2} reposts={9} likes={204}>Grind one step coarser. At our old setting the cup turned bitter by the third minute.</SocialPost>
        <SocialPost author={still} time="3h" media={cup} replies={4} reposts={11} likes={268}>{'Water at 94°C, not boiling. The red fruit holds. #pourover'}</SocialPost>
        <SocialPost author={{ name: 'Maren Holt', handle: 'maren_roasts' }} time="1h" likes={37}>{'@stillcoffee Tried both at home with a cone dripper. Sweeter, less bite.'}</SocialPost>
      </PostThread>
    </div>
  );
}
```

## Installation

```sh
npm install @brand-studio/ui
```

React 18 or 19 is a peer dependency. Import the stylesheet once and wrap the app in a brand theme:

```tsx
import '@brand-studio/ui/styles.css';
import { BrandTheme, PostThread } from '@brand-studio/ui';
import brand from './brand.json';

<BrandTheme palette={brand.tokens} mode="system">
  {/* your app */}
</BrandTheme>
```

## Usage

```tsx
import { PostThread, SocialPost } from '@brand-studio/ui';
```

```tsx
<PostThread label="Brewing the Huila lot">
  <SocialPost author={still} time="3h">Two changes for the Huila lot, from this morning's cupping.</SocialPost>
  <SocialPost author={still} time="3h">Grind one step coarser.</SocialPost>
  <SocialPost author={maren} time="1h">{'@stillcoffee Tried both at home. Sweeter, less bite.'}</SocialPost>
</PostThread>
```

Put `SocialPost` items inside, oldest first. The thread draws one frame around them and a line from each avatar down to the next, so a reader can follow who answered whom.

## Accessibility

- The thread is an ordered list named by `label`, so screen readers announce how many posts it holds and where each one sits.
- Each post keeps its own article name, buttons and links.

## API Reference

| Prop | Type | Default |
|---|---|---|
| `children` | `React.ReactNode` | – |
| `label?` | `string` | – |
| `className?` | `string` | – |

Source: https://brandstudio.js.org/docs/components/post-thread/
