Displays a message in a conversation, with optional avatar, header, footer, and alignment.
Message
Deploying to prod real quick.
It's 4:55 PM. On a Friday.
It's a one-line change.
It's always a one-line change 😭. Make sure to run the
tests this time.
Alright, go for it.
Avatar
CN
Something went wrong. Any idea?
ER
I checked the latest deployment and found the build failed
during dependency installation.
ER
Something went wrong. Any idea?
CN
I checked the latest deployment and found the build failed
during dependency installation.
Can you share the exact error message from the logs?
CN
Something went wrong. Any idea?
Group
I checked the registry addresses.
The component and example JSON now live under the UI registry.
I checked the registry addresses.
The component and example JSON now live under the UI registry.
I checked the registry addresses.
CN
The component and example JSON now live under the UI registry.
I checked the registry addresses.
CN
The component and example JSON now live under the UI registry.
Group Chat
Why is the dashboard showing zero users
Define "zero."
ER
What do you mean?
@eve can you check?
Checking the logs...
Eve
I found the following error in the logs:
- Error: No users found
- Stack trace:
- at src/users/services/user-service.ts:123
- at src/users/services/get-user.ts:230
Can you check if the users are being created?
Header and Footer
You
Can we keep this style quiet and send the update today?
Delivered
Olivia 1m ago
I checked the logs. The retry finished and the missing invoices
are included now.
From Support queue
Marina
I drafted the reply with the exact filter path and a link to the
export history.
Draft ready
Assistant note
Ghost messages keep long-form assistant notes aligned with the
surrounding text instead of adding a frame.
Internal only
Automation warning
The old export link expires in 10 minutes. Regenerate before
sending this transcript externally.
Needs action
Actions
What is the status of the deployment?
ER
The install failure is coming from the workspace package. I can
open the exact log line or retry the deployment.
Okay drop me a link. I'll check it out.
Failed to send
Attachment
Here's the image. Can you add it to the PDF? Use it for the
cover page.
Done. Here's the PDF with the image added as the cover
page.
sales-dashboard.pdf PDF · 2.4 MB
Thanks. Looks good.
Attachment Group
Here are the brand photos. Can you add them to the deck?
Done. Here's the draft deck and the exported assets.
brand-deck.pdf PDF · 3.1 MB
brand-deck.key Keynote · 9 MB
brand-assets.zip ZIP · 4.2 MB
<script lang="ts">
import { Example, ExampleWrapper } from '@sveltery/components/example';
import {
Attachment,
AttachmentAction,
AttachmentActions,
AttachmentContent,
AttachmentDescription,
AttachmentGroup,
AttachmentMedia,
AttachmentTitle,
} from '@sveltery/components/attachment';
import { Avatar, AvatarFallback, AvatarImage } from '@sveltery/components/avatar';
import { Bubble, BubbleContent, BubbleGroup, BubbleReactions } from '@sveltery/components/bubble';
import { Button } from '@sveltery/components/button';
import { IconPlaceholder } from '@sveltery/components/icons';
import { Marker, MarkerContent, MarkerIcon } from '@sveltery/components/marker';
import {
Message,
MessageAvatar,
MessageContent,
MessageFooter,
MessageGroup,
MessageHeader,
} from '@sveltery/components/message';
import { Spinner } from '@sveltery/components/spinner';
</script>
{#snippet MessageDefault()}
<Example title="Message">
<div class="flex w-full max-w-md min-w-0 flex-col gap-10">
<Message align="end">
<MessageContent>
<Bubble>
<BubbleContent>Deploying to prod real quick.</BubbleContent>
</Bubble>
</MessageContent>
</Message>
<Message>
<MessageContent>
<Bubble variant="muted">
<BubbleContent>It's 4:55 PM. On a Friday.</BubbleContent>
</Bubble>
</MessageContent>
</Message>
<Message align="end">
<MessageContent>
<Bubble>
<BubbleContent>It's a one-line change.</BubbleContent>
</Bubble>
</MessageContent>
</Message>
<Message>
<MessageContent>
<BubbleGroup>
<Bubble variant="muted">
<BubbleContent>
It's always a one-line change 😭. Make sure to run the
tests this time.
</BubbleContent>
</Bubble>
<Bubble variant="muted">
<BubbleContent>Alright, go for it.</BubbleContent>
</Bubble>
</BubbleGroup>
</MessageContent>
</Message>
</div>
</Example>
{/snippet}
{#snippet MessageWithAvatar()}
<Example title="Avatar">
<div class="flex w-full max-w-md flex-col gap-10">
<Message>
<MessageAvatar>
<Avatar>
<AvatarImage
src="https://github.com/shadcn.png"
alt="@shadcn"
class="grayscale"
/>
<AvatarFallback>CN</AvatarFallback>
</Avatar>
</MessageAvatar>
<MessageContent>
<Bubble variant="muted">
<BubbleContent>Something went wrong. Any idea?</BubbleContent>
</Bubble>
</MessageContent>
</Message>
<Message>
<MessageAvatar>
<Avatar>
<AvatarImage
src="https://github.com/evilrabbit.png"
alt="@evilrabbit"
/>
<AvatarFallback>ER</AvatarFallback>
</Avatar>
</MessageAvatar>
<MessageContent>
<Bubble variant="muted">
<BubbleContent>
I checked the latest deployment and found the build failed
during dependency installation.
</BubbleContent>
</Bubble>
</MessageContent>
</Message>
<Message align="end">
<MessageAvatar>
<Avatar>
<AvatarImage
src="https://github.com/evilrabbit.png"
alt="@evilrabbit"
/>
<AvatarFallback>ER</AvatarFallback>
</Avatar>
</MessageAvatar>
<MessageContent>
<Bubble variant="muted">
<BubbleContent>Something went wrong. Any idea?</BubbleContent>
</Bubble>
</MessageContent>
</Message>
<Message>
<MessageAvatar>
<Avatar>
<AvatarImage
src="https://avatar.vercel.sh/shadcn"
alt="@shadcn"
/>
<AvatarFallback>CN</AvatarFallback>
</Avatar>
</MessageAvatar>
<MessageContent>
<Bubble variant="muted">
<BubbleContent class="space-y-2">
<div>
I checked the latest deployment and found the build failed
during dependency installation.
</div>
<div>Can you share the exact error message from the logs?</div>
</BubbleContent>
</Bubble>
</MessageContent>
</Message>
<Message>
<MessageAvatar>
<Avatar>
<AvatarFallback>CN</AvatarFallback>
</Avatar>
</MessageAvatar>
<MessageContent>
<Bubble variant="destructive">
<BubbleContent>Something went wrong. Any idea?</BubbleContent>
</Bubble>
</MessageContent>
</Message>
</div>
</Example>
{/snippet}
{#snippet MessageGroupExample()}
<Example title="Group">
<div class="flex w-full max-w-md flex-col gap-10">
<MessageGroup>
<Message>
<MessageContent>
<Bubble variant="muted">
<BubbleContent>I checked the registry addresses.</BubbleContent>
</Bubble>
</MessageContent>
</Message>
<Message>
<MessageContent>
<Bubble variant="muted">
<BubbleContent>
The component and example JSON now live under the UI registry.
</BubbleContent>
</Bubble>
</MessageContent>
</Message>
</MessageGroup>
<MessageGroup>
<Message align="end">
<MessageContent>
<Bubble variant="muted">
<BubbleContent>I checked the registry addresses.</BubbleContent>
</Bubble>
</MessageContent>
</Message>
<Message align="end">
<MessageContent>
<Bubble variant="muted">
<BubbleContent>
The component and example JSON now live under the UI registry.
</BubbleContent>
</Bubble>
</MessageContent>
</Message>
</MessageGroup>
<MessageGroup>
<Message align="end">
<MessageAvatar />
<MessageContent>
<Bubble variant="muted">
<BubbleContent>I checked the registry addresses.</BubbleContent>
</Bubble>
</MessageContent>
</Message>
<Message align="end">
<MessageAvatar>
<Avatar>
<AvatarImage
src="https://avatar.vercel.sh/shadcn"
alt="@shadcn"
/>
<AvatarFallback>CN</AvatarFallback>
</Avatar>
</MessageAvatar>
<MessageContent>
<Bubble variant="muted">
<BubbleContent>
The component and example JSON now live under the UI registry.
</BubbleContent>
</Bubble>
</MessageContent>
</Message>
</MessageGroup>
<MessageGroup>
<Message>
<MessageAvatar />
<MessageContent>
<Bubble variant="muted">
<BubbleContent>I checked the registry addresses.</BubbleContent>
</Bubble>
</MessageContent>
</Message>
<Message>
<MessageAvatar>
<Avatar>
<AvatarImage
src="https://avatar.vercel.sh/shadcn"
alt="@shadcn"
/>
<AvatarFallback>CN</AvatarFallback>
</Avatar>
</MessageAvatar>
<MessageContent>
<Bubble variant="muted">
<BubbleContent>
The component and example JSON now live under the UI registry.
</BubbleContent>
</Bubble>
</MessageContent>
</Message>
</MessageGroup>
</div>
</Example>
{/snippet}
{#snippet MessageGroupChat()}
<Example title="Group Chat">
<div class="flex w-full max-w-md flex-col gap-10">
<Message align="end">
<MessageContent>
<Bubble variant="tinted">
<BubbleContent>
Why is the dashboard showing zero users
</BubbleContent>
</Bubble>
</MessageContent>
</Message>
<MessageGroup>
<Message>
<MessageAvatar />
<MessageContent>
<Bubble variant="muted">
<BubbleContent>Define "zero."</BubbleContent>
</Bubble>
</MessageContent>
</Message>
<Message>
<MessageAvatar>
<Avatar>
<AvatarImage
src="https://github.com/evilrabbit.png"
alt="@evilrabbit"
/>
<AvatarFallback>ER</AvatarFallback>
</Avatar>
</MessageAvatar>
<MessageContent>
<Bubble variant="muted">
<BubbleContent>What do you mean?</BubbleContent>
</Bubble>
</MessageContent>
</Message>
</MessageGroup>
<Message align="end">
<MessageContent>
<Bubble variant="tinted">
<BubbleContent>
<span class="font-medium">@eve</span> can you check?
</BubbleContent>
</Bubble>
</MessageContent>
</Message>
<Message>
<Marker role="status">
<MarkerIcon>
<Spinner />
</MarkerIcon>
<MarkerContent>Checking the logs...</MarkerContent>
</Marker>
</Message>
<Message>
<MessageContent>
<MessageHeader>Eve</MessageHeader>
<Bubble variant="ghost">
<BubbleContent>
<span class="whitespace-pre-wrap">
{`I found the following error in the logs:
- Error: No users found
- Stack trace:
- at src/users/services/user-service.ts:123
- at src/users/services/get-user.ts:230
Can you check if the users are being created?`}
</span>
</BubbleContent>
</Bubble>
</MessageContent>
</Message>
</div>
</Example>
{/snippet}
{#snippet MessageHeaderFooter()}
<Example title="Header and Footer">
<div class="flex w-full max-w-md flex-col gap-12">
<Message align="end">
<MessageContent>
<MessageHeader class="justify-end">You</MessageHeader>
<Bubble>
<BubbleContent>
Can we keep this style quiet and send the update today?
</BubbleContent>
</Bubble>
<MessageFooter class="gap-2">
<span>Delivered</span>
<Button variant="ghost" size="xs">
Undo
</Button>
</MessageFooter>
</MessageContent>
</Message>
<Message align="start">
<MessageContent>
<MessageHeader>
<span>Olivia</span>
<span class="ml-auto font-normal">1m ago</span>
</MessageHeader>
<Bubble variant="muted">
<BubbleContent>
I checked the logs. The retry finished and the missing invoices
are included now.
</BubbleContent>
<BubbleReactions>
<Button variant="ghost" size="xs">
Thanks
</Button>
</BubbleReactions>
</Bubble>
<MessageFooter class="gap-2">
<span>From Support queue</span>
<Button variant="ghost" size="xs">
Copy
</Button>
</MessageFooter>
</MessageContent>
</Message>
<Message align="end">
<MessageContent>
<MessageHeader>Marina</MessageHeader>
<Bubble variant="outline">
<BubbleContent>
I drafted the reply with the exact filter path and a link to the
export history.
</BubbleContent>
</Bubble>
<MessageFooter class="gap-2">
<span>Draft ready</span>
<Button variant="outline" size="xs">
Review
</Button>
<Button size="xs">Send</Button>
</MessageFooter>
</MessageContent>
</Message>
<Message align="start">
<MessageContent>
<MessageHeader>Assistant note</MessageHeader>
<Bubble variant="ghost">
<BubbleContent>
Ghost messages keep long-form assistant notes aligned with the
surrounding text instead of adding a frame.
</BubbleContent>
</Bubble>
<MessageFooter class="gap-2">
<span>Internal only</span>
<Button variant="ghost" size="xs">
Pin
</Button>
</MessageFooter>
</MessageContent>
</Message>
<Message align="end">
<MessageContent>
<MessageHeader class="justify-end">
Automation warning
</MessageHeader>
<Bubble variant="destructive">
<BubbleContent>
The old export link expires in 10 minutes. Regenerate before
sending this transcript externally.
</BubbleContent>
</Bubble>
<MessageFooter class="gap-2">
<span>Needs action</span>
<Button variant="destructive" size="xs">
Regenerate
</Button>
</MessageFooter>
</MessageContent>
</Message>
</div>
</Example>
{/snippet}
{#snippet MessageActions()}
<Example title="Actions">
<div class="flex w-full max-w-md flex-col gap-10">
<Message align="end">
<MessageContent>
<Bubble>
<BubbleContent>
What is the status of the deployment?
</BubbleContent>
</Bubble>
<MessageFooter>
<Button
variant="ghost"
size="icon"
aria-label="Copy"
title="Copy"
>
<IconPlaceholder
lucide="CopyIcon"
tabler="IconCopy"
hugeicons="Copy01Icon"
phosphor="CopyIcon"
remixicon="RiFileCopyLine"
/>
</Button>
<Button
variant="ghost"
size="icon"
aria-label="Retry"
title="Retry"
>
<IconPlaceholder
lucide="RefreshCcwIcon"
tabler="IconRefresh"
hugeicons="ReloadIcon"
phosphor="ArrowClockwiseIcon"
remixicon="RiRefreshLine"
/>
</Button>
</MessageFooter>
</MessageContent>
</Message>
<Message>
<MessageAvatar>
<Avatar>
<AvatarImage
src="https://github.com/evilrabbit.png"
alt="@evilrabbit"
/>
<AvatarFallback>ER</AvatarFallback>
</Avatar>
</MessageAvatar>
<MessageContent>
<Bubble variant="muted">
<BubbleContent>
The install failure is coming from the workspace package. I can
open the exact log line or retry the deployment.
</BubbleContent>
</Bubble>
<MessageFooter>
<Button
variant="ghost"
size="icon"
aria-label="Copy"
title="Copy"
>
<IconPlaceholder
lucide="CopyIcon"
tabler="IconCopy"
hugeicons="Copy01Icon"
phosphor="CopyIcon"
remixicon="RiFileCopyLine"
/>
</Button>
<Button
variant="ghost"
size="icon"
aria-label="Like: thumbs up"
title="Like: thumbs up"
>
<IconPlaceholder
lucide="ThumbsUpIcon"
tabler="IconThumbUp"
hugeicons="ThumbsUpIcon"
phosphor="ThumbsUpIcon"
remixicon="RiThumbUpLine"
/>
</Button>
<Button
variant="ghost"
size="icon"
aria-label="Like: thumbs down"
title="Like: thumbs down"
>
<IconPlaceholder
lucide="ThumbsDownIcon"
tabler="IconThumbDown"
hugeicons="ThumbsDownIcon"
phosphor="ThumbsDownIcon"
remixicon="RiThumbDownLine"
/>
</Button>
</MessageFooter>
</MessageContent>
</Message>
<Message align="end">
<MessageContent>
<Bubble>
<BubbleContent>
Okay drop me a link. I'll check it out.
</BubbleContent>
</Bubble>
<MessageFooter class="gap-2">
<span class="font-normal text-destructive">
Failed to send
</span>
<Button variant="secondary" size="xs">
Retry
</Button>
</MessageFooter>
</MessageContent>
</Message>
</div>
</Example>
{/snippet}
{#snippet MessageAttachment()}
<Example title="Attachment">
<div class="flex w-full max-w-sm flex-col gap-8">
<Message align="end">
<MessageContent>
<Attachment orientation="vertical">
<AttachmentMedia variant="image">
<img
src="https://images.unsplash.com/photo-1497366754035-f200968a6e72?w=900&auto=format&fit=crop&q=80"
alt="Workspace"
/>
</AttachmentMedia>
</Attachment>
<Bubble>
<BubbleContent>
Here's the image. Can you add it to the PDF? Use it for the
cover page.
</BubbleContent>
</Bubble>
</MessageContent>
</Message>
<Message>
<MessageContent>
<Bubble variant="muted">
<BubbleContent>
Done. Here's the PDF with the image added as the cover
page.
</BubbleContent>
</Bubble>
<Attachment>
<AttachmentMedia>
<IconPlaceholder
lucide="FileTextIcon"
tabler="IconFileText"
hugeicons="FileIcon"
phosphor="FileTextIcon"
remixicon="RiFileTextLine"
/>
</AttachmentMedia>
<AttachmentContent>
<AttachmentTitle>sales-dashboard.pdf</AttachmentTitle>
<AttachmentDescription>PDF · 2.4 MB</AttachmentDescription>
</AttachmentContent>
<AttachmentActions>
<AttachmentAction
type="button"
title="Download"
aria-label="Download"
size="icon-sm"
variant="secondary"
>
<IconPlaceholder
lucide="DownloadIcon"
tabler="IconDownload"
hugeicons="Download01Icon"
phosphor="DownloadIcon"
remixicon="RiDownloadLine"
/>
</AttachmentAction>
</AttachmentActions>
</Attachment>
</MessageContent>
</Message>
<Message align="end">
<MessageContent>
<Bubble>
<BubbleContent>Thanks. Looks good.</BubbleContent>
</Bubble>
</MessageContent>
</Message>
</div>
</Example>
{/snippet}
{#snippet MessageAttachmentGroup()}
<Example title="Attachment Group">
<div class="flex w-full max-w-sm flex-col gap-8">
<Message align="end">
<MessageContent>
<AttachmentGroup class="w-[80%]">
<Attachment orientation="vertical">
<AttachmentMedia variant="image">
<img
src="https://images.unsplash.com/photo-1497366754035-f200968a6e72?w=900&auto=format&fit=crop&q=80"
alt="Workspace"
/>
</AttachmentMedia>
</Attachment>
<Attachment orientation="vertical">
<AttachmentMedia variant="image">
<img
src="https://images.unsplash.com/photo-1497215728101-856f4ea42174?w=900&auto=format&fit=crop&q=80"
alt="Desk"
/>
</AttachmentMedia>
</Attachment>
<Attachment orientation="vertical">
<AttachmentMedia variant="image">
<img
src="https://images.unsplash.com/photo-1497366811353-6870744d04b2?w=900&auto=format&fit=crop&q=80"
alt="Office"
/>
</AttachmentMedia>
</Attachment>
</AttachmentGroup>
<Bubble>
<BubbleContent>
Here are the brand photos. Can you add them to the deck?
</BubbleContent>
</Bubble>
</MessageContent>
</Message>
<Message>
<MessageContent>
<Bubble variant="muted">
<BubbleContent>
Done. Here's the draft deck and the exported assets.
</BubbleContent>
</Bubble>
<AttachmentGroup class="w-full">
<Attachment class="w-64">
<AttachmentMedia>
<IconPlaceholder
lucide="FileTextIcon"
tabler="IconFileText"
hugeicons="FileIcon"
phosphor="FileTextIcon"
remixicon="RiFileTextLine"
/>
</AttachmentMedia>
<AttachmentContent>
<AttachmentTitle>brand-deck.pdf</AttachmentTitle>
<AttachmentDescription>PDF · 3.1 MB</AttachmentDescription>
</AttachmentContent>
<AttachmentActions>
<AttachmentAction
type="button"
title="Download"
aria-label="Download brand-deck.pdf"
size="icon-sm"
variant="secondary"
>
<IconPlaceholder
lucide="DownloadIcon"
tabler="IconDownload"
hugeicons="Download01Icon"
phosphor="DownloadIcon"
remixicon="RiDownloadLine"
/>
</AttachmentAction>
</AttachmentActions>
</Attachment>
<Attachment class="w-64">
<AttachmentMedia>
<IconPlaceholder
lucide="PresentationIcon"
tabler="IconPresentation"
hugeicons="Presentation01Icon"
phosphor="PresentationIcon"
remixicon="RiSlideshowLine"
/>
</AttachmentMedia>
<AttachmentContent>
<AttachmentTitle>brand-deck.key</AttachmentTitle>
<AttachmentDescription>Keynote · 9 MB</AttachmentDescription>
</AttachmentContent>
<AttachmentActions>
<AttachmentAction
type="button"
title="Download"
aria-label="Download brand-deck.key"
size="icon-sm"
variant="secondary"
>
<IconPlaceholder
lucide="DownloadIcon"
tabler="IconDownload"
hugeicons="Download01Icon"
phosphor="DownloadIcon"
remixicon="RiDownloadLine"
/>
</AttachmentAction>
</AttachmentActions>
</Attachment>
<Attachment class="w-64">
<AttachmentMedia>
<IconPlaceholder
lucide="FileArchiveIcon"
tabler="IconFileZip"
hugeicons="File01Icon"
phosphor="FileZipIcon"
remixicon="RiFileZipLine"
/>
</AttachmentMedia>
<AttachmentContent>
<AttachmentTitle>brand-assets.zip</AttachmentTitle>
<AttachmentDescription>ZIP · 4.2 MB</AttachmentDescription>
</AttachmentContent>
<AttachmentActions>
<AttachmentAction
type="button"
title="Download"
aria-label="Download brand-assets.zip"
size="icon-sm"
variant="secondary"
>
<IconPlaceholder
lucide="DownloadIcon"
tabler="IconDownload"
hugeicons="Download01Icon"
phosphor="DownloadIcon"
remixicon="RiDownloadLine"
/>
</AttachmentAction>
</AttachmentActions>
</Attachment>
</AttachmentGroup>
</MessageContent>
</Message>
</div>
</Example>
{/snippet}
<ExampleWrapper>
{@render MessageDefault()}
{@render MessageWithAvatar()}
{@render MessageGroupExample()}
{@render MessageGroupChat()}
{@render MessageHeaderFooter()}
{@render MessageActions()}
{@render MessageAttachment()}
{@render MessageAttachmentGroup()}
</ExampleWrapper>Installation
Install the dependencies
pnpm add cnCopy the component
Copy the following files into src/lib/components/ui/message.
<script lang="ts">
import type { MessageProps } from './types.js';
import { cn } from 'cn';
let { children, class: classProp, align = 'start', ...props }: MessageProps = $props();
</script>
<div data-slot="message" data-align={align} {...props} class={cn('text-sm gap-2 group/message relative flex w-full min-w-0 data-[align=end]:flex-row-reverse', classProp)}>
{@render children?.()}
</div><script lang="ts">
import type { MessageAvatarProps } from './types.js';
import { cn } from 'cn';
let { children, class: classProp, ...props }: MessageAvatarProps = $props();
</script>
<div data-slot="message-avatar" {...props} class={cn('min-w-8 group-has-data-[slot=message-footer]/message:-translate-y-8 flex w-fit shrink-0 items-center justify-center self-end overflow-hidden rounded-full bg-muted', classProp)}>
{@render children?.()}
</div><script lang="ts">
import type { MessageContentProps } from './types.js';
import { cn } from 'cn';
let { children, class: classProp, ...props }: MessageContentProps = $props();
</script>
<div data-slot="message-content" {...props} class={cn('gap-2.5 group-data-[align=end]/message:*:data-slot:self-end flex w-full min-w-0 flex-col wrap-break-word', classProp)}>
{@render children?.()}
</div><script lang="ts">
import type { MessageFooterProps } from './types.js';
import { cn } from 'cn';
let { children, class: classProp, ...props }: MessageFooterProps = $props();
</script>
<div data-slot="message-footer" {...props} class={cn('text-xs font-medium text-muted-foreground px-3 group-has-data-[variant=ghost]/message:px-0 flex max-w-full min-w-0 items-center group-data-[align=end]/message:justify-end', classProp)}>
{@render children?.()}
</div><script lang="ts">
import type { MessageGroupProps } from './types.js';
import { cn } from 'cn';
let { children, class: classProp, ...props }: MessageGroupProps = $props();
</script>
<div data-slot="message-group" {...props} class={cn('gap-2 flex min-w-0 flex-col', classProp)}>
{@render children?.()}
</div><script lang="ts">
import type { MessageHeaderProps } from './types.js';
import { cn } from 'cn';
let { children, class: classProp, ...props }: MessageHeaderProps = $props();
</script>
<div data-slot="message-header" {...props} class={cn('text-xs font-medium text-muted-foreground px-3 group-has-data-[variant=ghost]/message:px-0 flex max-w-full min-w-0 items-center', classProp)}>
{@render children?.()}
</div>import type { HTMLAttributes } from 'svelte/elements';
type NativeDivProps = HTMLAttributes<HTMLDivElement>;
export type MessageGroupProps = NativeDivProps;
export type MessageProps = NativeDivProps & { align?: 'start' | 'end' };
export type MessageAvatarProps = NativeDivProps;
export type MessageContentProps = NativeDivProps;
export type MessageHeaderProps = NativeDivProps;
export type MessageFooterProps = NativeDivProps;export { default as MessageGroup } from './MessageGroup.svelte';
export { default as Message } from './Message.svelte';
export { default as MessageAvatar } from './MessageAvatar.svelte';
export { default as MessageContent } from './MessageContent.svelte';
export { default as MessageHeader } from './MessageHeader.svelte';
export { default as MessageFooter } from './MessageFooter.svelte';
export type { MessageGroupProps, MessageProps, MessageAvatarProps, MessageContentProps, MessageHeaderProps, MessageFooterProps } from './types.js';Update the import paths
Change the imports to match your project setup.
Usage
<script lang="ts">
import { Message, MessageAvatar, MessageContent, MessageFooter, MessageHeader } from '$lib/components/ui/message';
</script><Message align="end">
<MessageAvatar>
<img src="/avatar.png" alt="Rhea" />
</MessageAvatar>
<MessageContent>
<MessageHeader>Rhea</MessageHeader>
<p>The build is green.</p>
<MessageFooter>Read 2:14 PM</MessageFooter>
</MessageContent>
</Message>