Assistant Message
Left-aligned with an avatar and a wider measure.
<Message role="assistant">
<Message.Content>
Of course! I'd be happy to help. What would you like to know?
</Message.Content>
</Message>Shows one chat message, styled by who sent it.
import { Message } from "@/fragments/ui";Source<Message role="user">
<Message.Content>
Hello! Can you help me with a coding question?
</Message.Content>
</Message>npx @usefragments/cli add messageWrites src/fragments/ui/components/Message plus what it imports, the globals stylesheet, and .fragments/registry-lock.json, then prints the packages to add. No account, no key.
Your own registry: publish from Fragments Cloud and add --registry org/name. Connect a workspace.
Message is a compound: import the root and reach its parts through dot notation.
Message.ContentMessage.ActionsMessage.TimestampMessage.AvatarRight-aligned and capped at 80% of the available width.
<Message role="user">
<Message.Content>
Hello! Can you help me with a coding question?
</Message.Content>
</Message>Left-aligned with an avatar and a wider measure.
<Message role="assistant">
<Message.Content>
Of course! I'd be happy to help. What would you like to know?
</Message.Content>
</Message>Centred and quiet, for context rather than conversation.
<Message role="system">
<Message.Content>
Conversation started. Model: GPT-4
</Message.Content>
</Message>A blinking caret trails the text as it arrives.
<Message role="assistant" status="streaming">
<Message.Content>
I'm currently generating a response for you
</Message.Content>
</Message>A relative send time sits beneath the bubble.
<Message role="assistant" timestamp={new Date(Date.now() - 300000)}>
<Message.Content>
This message was sent 5 minutes ago.
</Message.Content>
<Message.Timestamp />
</Message>A failed send turns the bubble and its border red.
<Message role="user" status="error">
<Message.Content>
This message failed to send.
</Message.Content>
</Message>Photos replace the default glyphs on both sides.
<>
<Message
role="user"
avatar={<Message.Avatar src="https://i.pravatar.cc/64?u=user" alt="Jane" />}
>
<Message.Content>Controls stay hidden until the pointer enters the row.
<Message
role="assistant"
actions={
<>
<Button variant="ghost" size="sm">
CopyProp | Type | Default | Description |
|---|---|---|---|
roleRequired | enumuserassistantsystem | Not set | Message role determines styling and alignment |
childrenRequired | node | Not set | Message content |
status | enumpendingstreamingcompleteerror | complete | Message state |
timestamp | object | Not set | When the message was sent |
avatar | node | Not set | Custom avatar override (null to hide) |
actions | node | Not set | Hover actions (copy, regenerate) |