# Message

Displays a message in a conversation, with optional avatar, header, footer, and alignment.

Section: Blocks / Chat
Page: https://ui.heyramzi.com/components/message
Import path: `@heyramzi/ui/shadcn/message`

## Import

```ts
import * as Avatar from "@heyramzi/ui/shadcn/avatar";
import * as Bubble from "@heyramzi/ui/shadcn/bubble";
import * as Marker from "@heyramzi/ui/shadcn/marker";
import * as Message from "@heyramzi/ui/shadcn/message";
```

## Usage

```svelte
<Message.Root align="end">
  <Message.Avatar>
    <img src="/avatars/10.png" alt="@me" />
  </Message.Avatar>
  <Message.Content>
    It's a one-line change.
    <Message.Footer>Delivered</Message.Footer>
  </Message.Content>
</Message.Root>
```

## Demo

```svelte
<script lang="ts">
	import * as Avatar from "@heyramzi/ui/shadcn/avatar";
	import * as Bubble from "@heyramzi/ui/shadcn/bubble";
	import * as Marker from "@heyramzi/ui/shadcn/marker";
	import * as Message from "@heyramzi/ui/shadcn/message";
</script>

<div class="flex w-full max-w-sm flex-col gap-6 py-12">
	<Message.Root align="end">
		<Message.Avatar>
			<Avatar.Root>
				<Avatar.Image src="/avatars/10.png" alt="@me" />
				<Avatar.Fallback>ME</Avatar.Fallback>
			</Avatar.Root>
		</Message.Avatar>
		<Message.Content>
			<Bubble.Root>
				<Bubble.Content>Deploying to prod real quick.</Bubble.Content>
			</Bubble.Root>
		</Message.Content>
	</Message.Root>
	<Message.Root>
		<Message.Avatar>
			<Avatar.Root>
				<Avatar.Image src="/avatars/02.png" alt="@rabbit" />
				<Avatar.Fallback>R</Avatar.Fallback>
			</Avatar.Root>
		</Message.Avatar>
		<Message.Content>
			<Bubble.Root variant="muted">
				<Bubble.Content>It's 4:55 PM. On a Friday.</Bubble.Content>
			</Bubble.Root>
		</Message.Content>
	</Message.Root>
	<Message.Root align="end">
		<Message.Avatar>
			<Avatar.Root>
				<Avatar.Image src="/avatars/10.png" alt="@me" />
				<Avatar.Fallback>ME</Avatar.Fallback>
			</Avatar.Root>
		</Message.Avatar>
		<Message.Content>
			<Bubble.Root>
				<Bubble.Content>It's a one-line change.</Bubble.Content>
			</Bubble.Root>
			<Message.Footer>Delivered</Message.Footer>
		</Message.Content>
	</Message.Root>
	<Message.Root>
		<Message.Avatar>
			<Avatar.Root>
				<Avatar.Image src="/avatars/02.png" alt="@rabbit" />
				<Avatar.Fallback>R</Avatar.Fallback>
			</Avatar.Root>
		</Message.Avatar>
		<Message.Content>
			<Bubble.Group>
				<Bubble.Root variant="muted">
					<Bubble.Content>It's always a one-line change 😭.</Bubble.Content>
				</Bubble.Root>
				<Bubble.Root variant="muted">
					<Bubble.Content>Alright, let me take a look.</Bubble.Content>
					<Bubble.Reactions aria-label="Reactions: thumbs up">
						<span>👍</span>
					</Bubble.Reactions>
				</Bubble.Root>
			</Bubble.Group>
		</Message.Content>
	</Message.Root>
	<Marker.Root role="status">
		<Marker.Content class="shimmer">
			<span class="font-medium">Oliver</span> is typing...
		</Marker.Content>
	</Marker.Root>
</div>
```

## API

### Message.Root

| Prop | Type | Default | Notes |
| --- | --- | --- | --- |
| `align` | `"start" \| "end"` | `"start"` |  |
| `ref` | `HTMLDivElement \| null` | `null` | bindable |
| `class` | `string` |  |  |
| `children` | `Snippet` |  |  |

Every prop of `HTMLAttributes<HTMLDivElement>` from `svelte/elements`.

### Message.Avatar

| Prop | Type | Default | Notes |
| --- | --- | --- | --- |
| `ref` | `HTMLDivElement \| null` | `null` | bindable |
| `class` | `string` |  |  |
| `children` | `Snippet` |  |  |

Every prop of `HTMLAttributes<HTMLDivElement>` from `svelte/elements`.

### Message.Content

| Prop | Type | Default | Notes |
| --- | --- | --- | --- |
| `ref` | `HTMLDivElement \| null` | `null` | bindable |
| `class` | `string` |  |  |
| `children` | `Snippet` |  |  |

Every prop of `HTMLAttributes<HTMLDivElement>` from `svelte/elements`.

### Message.Footer

| Prop | Type | Default | Notes |
| --- | --- | --- | --- |
| `ref` | `HTMLDivElement \| null` | `null` | bindable |
| `class` | `string` |  |  |
| `children` | `Snippet` |  |  |

Every prop of `HTMLAttributes<HTMLDivElement>` from `svelte/elements`.

### Message.Group

| Prop | Type | Default | Notes |
| --- | --- | --- | --- |
| `ref` | `HTMLDivElement \| null` | `null` | bindable |
| `class` | `string` |  |  |
| `children` | `Snippet` |  |  |

Every prop of `HTMLAttributes<HTMLDivElement>` from `svelte/elements`.

### Message.Header

| Prop | Type | Default | Notes |
| --- | --- | --- | --- |
| `ref` | `HTMLDivElement \| null` | `null` | bindable |
| `class` | `string` |  |  |
| `children` | `Snippet` |  |  |

Every prop of `HTMLAttributes<HTMLDivElement>` from `svelte/elements`.
