Skip to content
GitHub11 stars

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

ME
Deploying to prod real quick.
R
It's 4:55 PM. On a Friday.
ME
It's a one-line change.
Delivered
R
It's always a one-line change 😭.
Alright, let me take a look.
👍
Oliver is typing...
<div class="flex w-full max-w-sm flex-col gap-6 py-12">
    <Message Align="MessageAlign.End">
        <MessageAvatar>

The Message component lays out a single message in a conversation. It handles the avatar, alignment, header, and footer around the message surface.

For AI apps, you can render reasoning steps, tool calls and assistant messages using the Message component.

Installation

dnx Blazix.Cli add message

Usage

<Message>
    <MessageAvatar>
        <Avatar>
            <AvatarImage Src="https://avatar.vercel.sh/blazix" alt="@("@blazix")" />
            <AvatarFallback>BX</AvatarFallback>
        </Avatar>
    </MessageAvatar>
    <MessageContent>
        <Bubble><BubbleContent>How can I help you today?</BubbleContent></Bubble>
    </MessageContent>
</Message>

Note: Message owns the row layout—avatar, alignment, header, and footer. Render the visible message surface inside it with Bubble.

Composition

Use the following composition to build a message:

Message
├── MessageAvatar
└── MessageContent
    ├── MessageHeader
    ├── Bubble
    └── MessageFooter

Use MessageGroup to stack consecutive messages from the same sender:

MessageGroup
├── Message
└── Message

Features

  • Start and end alignment for sender and receiver rows via the Align parameter
  • Avatar slot that anchors to the bottom of the message and stays clear of the footer
  • Header and footer slots for sender names, status, and message actions
  • Footer follows the message side; actions stay aligned on align="end" rows
  • Group wrapper for stacking consecutive messages from the same sender
  • Customizable styling through the Class parameter on every part

Avatar

Use MessageAvatar to render an avatar next to the message. Set align="end" on the message to align the avatar to the end of the message.

R
The build failed during dependency installation.
R
Can you share the exact error?
R
Here's the error from the logs
Something went wrong with the build. The libraries are not installed correctly. Try running the build again.
<div class="flex w-full max-w-sm flex-col gap-6 py-12">
    <Message>
        <MessageAvatar>
alignDescription
startAlign the message to the start of the conversation.
endAlign the message to the end of the conversation.

Group

Use MessageGroup to stack consecutive messages from the same sender. Render an empty MessageAvatar on the earlier messages to keep them aligned with the avatar on the last one.

I checked the registry addresses.
BX
The component and example JSON now live under the UI registry.
<div class="flex w-full max-w-sm flex-col gap-6 py-12">
    <MessageGroup>
        <Message>

Use MessageHeader for a sender name and MessageFooter for metadata such as a delivery or read status.

Olivia
I already checked the logs.
Send the report to the team. Ping @blazix if you need help.
Read Yesterday
<div class="flex w-full max-w-sm flex-col gap-8 py-12">
    <Message>
        <MessageContent>

Actions

Place message-level actions in MessageFooter, such as copy, retry, or feedback buttons.

The install failure is coming from the workspace package.
Okay drop me a link. Taking a look...
Failed to send
<div class="flex w-full max-w-sm flex-col gap-8 py-12">
    <Message>
        <MessageContent>

Attachment

Workspace
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.
<div class="flex w-full max-w-sm flex-col gap-8 py-12">
    <Message Align="MessageAlign.End">
        <MessageContent>

Accessibility

Message is a presentational layout wrapper. Accessibility comes from the content you place inside it.

Label icon-only actions

Action buttons in MessageFooter are usually icon-only, so give each one an aria-label.

<MessageFooter>
    <Button Variant="ButtonVariant.Ghost" Size="ButtonSize.Icon" aria-label="Copy"><Icon Data="LucideIcons.Copy" /></Button>
</MessageFooter>

Status updates

For in-progress messages, use a Marker with role="status" so assistive tech announces the update as it appears.

<Message>
    <Marker role="status">
        <MarkerIcon><Spinner /></MarkerIcon>
        <MarkerContent>Checking the logs...</MarkerContent>
    </Marker>
</Message>

RTL

To enable RTL support in Blazix, see the RTL configuration guide.

Translated with AI for the demo, so it may have mistakes.

ME
سأنشر على الإنتاج بسرعة.
R
الساعة ٤:٥٥ مساءً. يوم جمعة.
ME
إنه تغيير في سطر واحد فقط.
تم التسليم
R
دائمًا ما يكون تغييرًا في سطر واحد 😭.
حسنًا، دعني ألقي نظرة.
أوليفر يكتب...
@* Align.End puts your own messages at the end of the reading direction: the left in RTL. *@
<div class="flex w-full max-w-sm flex-col gap-6 py-12">
    @foreach (var (mine, lines, footer) in T.Thread)

API Reference

Message

ParameterTypeDefault
Align MessageAlign MessageAlign.Start
Class string? -
ChildContent RenderFragment? -

Other attributes are passed to the element it renders.

MessageAvatar

ParameterTypeDefault
Class string? -
ChildContent RenderFragment? -

Other attributes are passed to the element it renders.

MessageContent

ParameterTypeDefault
Class string? -
ChildContent RenderFragment? -

Other attributes are passed to the element it renders.

MessageFooter

ParameterTypeDefault
Class string? -
ChildContent RenderFragment? -

Other attributes are passed to the element it renders.

MessageGroup

ParameterTypeDefault
Class string? -
ChildContent RenderFragment? -

Other attributes are passed to the element it renders.

MessageHeader

ParameterTypeDefault
Class string? -
ChildContent RenderFragment? -

Other attributes are passed to the element it renders.