# ChatMessage

> One conversation turn, aligned and dressed by its role, streaming its body while the answer arrives, with an action rail that fades in on hover and a version navigator underneath.

- Package: `fancy-ui-vue` (Vue 3.5+ + Tailwind CSS v4)
- Category: AI Chat
- Tags: ai, chat, message, compound, streaming
- Dependencies: streaming-text
- Types: `ChatMessageProps`, `ChatMessageActionsProps`, `ChatMessageActionProps`, `ChatMessageBranchesProps`, `ChatMessageContext`
- Docs: https://fancy-ui.rama.app/docs/components/chat-message
- Source: https://github.com/RamaHerbin/fancy-ui/tree/main/vue/src/components/chat-message

## Import

```vue
<script setup lang="ts">
import { ChatMessage } from 'fancy-ui-vue';
</script>
```

Setup (once per project): `npm install fancy-ui-vue`, then put these lines in your main CSS file (the stylesheet imports go right after `@import "tailwindcss";`):

```css
@import "tailwindcss";
@import "fancy-ui-vue/tailwind.css";
@import "fancy-ui-vue/styles.css";
```

Full guide: https://fancy-ui.rama.app/llms.txt

The names below are the ones to write in a Vue template; when one differs from the Svelte name, the Svelte name follows in parentheses. Snippets become named slots (`#default` is the default snippet), a prop the Vue port declares as a model is a `v-model:<name>` (except `ref`, exposed via `defineExpose({ ref })`: put a template ref on the component and read `.ref`) and callbacks are listeners (`onclick` is `@click`). Every component sets `inheritAttrs: false`: `class` is a declared prop, merged where the Svelte component applies it (not always the root element), and only when the props table below lists it; other attributes do not fall through unless the package README lists the component as forwarding native attributes. Divergences: https://github.com/RamaHerbin/fancy-ui/tree/main/vue#divergences-from-the-svelte-api

## Props

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `role` | `"user" \| "assistant" \| "system"` | `"assistant"` | Who produced the turn; drives alignment, chrome, and the accessible name |
| `content` | `string` | `""` | The body so far, not the latest delta; reassign with a longer string as chunks arrive |
| `streaming` | `boolean` | `false` | Whether content is still growing; shows the trailing cursor |
| `markdown` | `boolean` | `false` | Render the body as markdown instead of a tinted plain-text stream |
| `timestamp` | `Date \| number` | — | When the turn was produced; rendered relative, with the exact time as its tooltip |
| `sound` | `boolean` | `false` | Plays press on a message action and select on a branch step, once the user has enabled sound |

## Slots

| Slot | Description |
| --- | --- |
| `#avatar` (Svelte `avatar`) | Rendered beside the body: an image, initials, an icon |
| `#default` (Svelte `children`) | Replaces the default body rendering entirely; content is then ignored |
| `#actions` (Svelte `actions`) | The action rail — put ChatMessageActions here; fades in on hover or focus |
| `#footer` (Svelte `footer`) | Rendered under the body — where ChatMessageBranches belongs |

## Example

No Vue example is published for this component yet: start from the import above and the props table. The full examples are Svelte-only, on https://fancy-ui.rama.app/docs/components/chat-message.md.
