Message
Chat turn layout that wraps Bubble rows with an avatar and footer.
Import
Section titled “Import”import { Message, MessageAvatar, MessageContent, MessageFooter,} from "@pelagornis/page/components";Example
Section titled “Example”The preview above renders this file. Copy it into src/components/ to start from it.
import { Avatar, AvatarFallback, Bubble, BubbleContent, BubbleGroup, BubbleReactions, Message, MessageAvatar, MessageContent, MessageFooter, Stack,} from "@pelagornis/page/components";
export default function MessageDemo() { return ( <Stack gap="sizeLarge" className="w-full"> <Message align="end"> <MessageContent> <Bubble align="end"> <BubbleContent>Deploying to prod real quick.</BubbleContent> </Bubble> </MessageContent> </Message> <Message> <MessageAvatar> <Avatar alt="Rabbit"> <AvatarFallback>R</AvatarFallback> </Avatar> </MessageAvatar> <MessageContent> <Bubble variant="muted"> <BubbleContent>It's 4:55 PM. On a Friday.</BubbleContent> </Bubble> </MessageContent> </Message> <Message align="end"> <MessageContent> <Bubble align="end"> <BubbleContent>It's a one-line change.</BubbleContent> </Bubble> <MessageFooter>Delivered</MessageFooter> </MessageContent> </Message> <Message> <MessageAvatar> <Avatar alt="Rabbit"> <AvatarFallback>R</AvatarFallback> </Avatar> </MessageAvatar> <MessageContent> <BubbleGroup> <Bubble variant="muted"> <BubbleContent>It's always a one-line change.</BubbleContent> </Bubble> <Bubble variant="muted"> <BubbleContent>Alright, let me take a look.</BubbleContent> <BubbleReactions aria-label="Reaction: thumbs up"> <span aria-hidden>👍</span> </BubbleReactions> </Bubble> </BubbleGroup> </MessageContent> </Message> </Stack> );}Use in MDX
Section titled “Use in MDX”Message is composed from parts that share React state. Children written in MDX are rendered as separate islands, so the parts can’t reach each other. Put the composition in a .tsx file, like the example above, and import that file instead.
---title: Example---
import MessageExample from "../../components/MessageExample";
<MessageExample client:load />client:load hydrates the island on page load. Use client:visible for content far down the page.
Use in Markdoc
Section titled “Use in Markdoc”Markdoc tags render Astro components, and this one needs client state. Wrap the example in an .astro file that hydrates it, then register that file as a tag.
---import MessageExample from "../MessageExample";---
<MessageExample client:load />import { component, defineMarkdocConfig } from "@astrojs/markdoc/config";import starlightMarkdoc from "@astrojs/starlight-markdoc";import pageMarkdoc from "@pelagornis/page/markdoc";
export default defineMarkdocConfig({ extends: [starlightMarkdoc(), pageMarkdoc()], tags: { "message-example": { render: component("./src/components/markdoc/MessageExample.astro"), selfClosing: true, }, },});{% message-example /%}Variants
Section titled “Variants”Values the component accepts for each variant prop.
| Prop | Values |
|---|---|
align | start end |
Anatomy
Section titled “Anatomy”Parts of the component and the data-refineui role each one renders.
| Part | Role |
|---|---|
root | message |
avatar | message-avatar |
content | message-content |
footer | message-footer |
States
Section titled “States”States the component styles. Component states are exposed as data attributes.
Keyboard
Section titled “Keyboard”Keys the component handles when it has focus.
Reference
Section titled “Reference”- RefineUI · Message for design guidance and token detail.
- Use in MDX and Use in Markdoc for the general rules.