# Thread

Source: https://ecosphere.dev/docs/layout/thread (Ecosphere 1.5). Install `vue-ecosphere` for Vue 3 or `react-ecosphere` for React 18.2+/19: same components, props, markup and stylesheet.

A chat-style conversation: the other party on the left in the sunken surface, you on the right in the accent.

`import { EcoThread } from "vue-ecosphere"`

## Conversation

The side does the work, so nobody has to read a label to know who spoke. Type a message and press Enter.

Vue (vue-ecosphere):

```vue
<EcoThread
  name="Kiara Casmer"
  hint="Senior Product Designer · Northwind"
  my-initials="AJ"
  :messages="messages"
  height="640px"
  @send="(text) => messages.push({ text, mine: true, time: 'Now' })"
/>

// messages
[
  { day: "Today" },
  { text: "Hey — did you get a chance to look at the warehouse credentials?", time: "9:41 AM" },
  { text: "Yes. They're 14 months old and auto-renewal was never switched on for that host.", mine: true, time: "9:44 AM" },
  …
]
```

React (react-ecosphere):

```tsx
<EcoThread
  name="Kiara Casmer"
  hint="Senior Product Designer · Northwind"
  myInitials="AJ"
  messages={messages}
  height="640px"
  onSend={(text) => setMessages((m) => [...m, { text, mine: true, time: "Now" }])}
/>

// messages
[
  { day: "Today" },
  { text: "Hey — did you get a chance to look at the warehouse credentials?", time: "9:41 AM" },
  { text: "Yes. They're 14 months old and auto-renewal was never switched on for that host.", mine: true, time: "9:44 AM" },
  …
]
```

## Status bar, stacked and tinted

Stacked puts every message in one column with a name label; tint makes your bubbles quieter beside long replies.

Vue (vue-ecosphere):

```vue
<EcoThread
  name="Kiara Casmer"
  hint="Senior Product Designer · Northwind"
  status="Replied"
  status-tone="success"
  last="Last reply 2:20 PM"
  stacked
  tint
  :messages="messages"
/>
```

React (react-ecosphere):

```tsx
<EcoThread
  name="Kiara Casmer"
  hint="Senior Product Designer · Northwind"
  status="Replied"
  statusTone="success"
  last="Last reply 2:20 PM"
  stacked
  tint
  messages={messages}
/>
```

## API

Vue (vue-ecosphere):

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| `name / hint` | `string` | — | The other party and their role · organisation, in the header. |
| `initials / myInitials` | `string` | from name / "Me" | Avatar initials for their and your bubbles; a message's own initials win. |
| `messages` | `(ThreadMessage \| { day })[]` | [] | Oldest first. Consecutive messages from one side group into a burst: only the last shows the meta line and avatar. |
| `status / statusTone / last` | `string / StatusTone / string` | — | The status bar under the header (th__bar): a badge and muted last-activity text. #status slot overrides the badge. |
| `stacked` | `boolean` | false | One column with name labels, for narrow panes (chat--stacked). |
| `tint` | `boolean` | false | Your bubbles in the accent tint with dark ink (chat--tint). |
| `noAvatars / stamps` | `boolean` | false | Hide bubble avatars; a timestamp on every message. |
| `v-model:draft` | `string` | "" | The message box. Send is enabled only when it has text; Enter sends, Shift+Enter adds a line. |
| `placeholder` | `string` | "Message <first name>" | Composer placeholder and accessible name. |
| `actions` | `boolean` | true | Record details and close buttons in the header. #actions slot replaces them. |
| `height` | `string` | — | Height of the pane. Omit to size to the parent. |
| `@send / @attach / @details / @close` | `event` | — | Send carries the trimmed text and clears the draft. |
| `default / #composer` | `slot` | — | Replace the message list or the message box. |

React (react-ecosphere):

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| `name / hint` | `string` | — | The other party and their role · organisation, in the header. |
| `initials / myInitials` | `string` | from name / "Me" | Avatar initials for their and your bubbles; a message's own initials win. |
| `messages` | `(ThreadMessage \| { day })[]` | [] | Oldest first. Consecutive messages from one side group into a burst: only the last shows the meta line and avatar. |
| `status / statusTone / last` | `ReactNode / StatusTone / string` | — | The status bar under the header (th__bar): a badge and muted last-activity text. A string is the badge's text; a node replaces the badge. |
| `stacked` | `boolean` | false | One column with name labels, for narrow panes (chat--stacked). |
| `tint` | `boolean` | false | Your bubbles in the accent tint with dark ink (chat--tint). |
| `noAvatars / stamps` | `boolean` | false | Hide bubble avatars; a timestamp on every message. |
| `draft / onDraftChange` | `string` | "" | The message box. Send is enabled only when it has text; Enter sends, Shift+Enter adds a line. |
| `placeholder` | `string` | "Message <first name>" | Composer placeholder and accessible name. |
| `actions` | `boolean \| ReactNode` | true | Record details and close buttons in the header; false hides them, a node replaces them. |
| `height` | `string` | — | Height of the pane. Omit to size to the parent. |
| `onSend / onAttach / onDetails / onClose` | `event` | — | Send carries the trimmed text and clears the draft. |
| `children / composer` | `ReactNode` | — | Replace the message list or the message box. |
