Make your AI a shadcn expert

Shadcn Message

React message for chat rows in a thread or assistant. Built with TypeScript and Tailwind CSS for Next.js using Base UI — avatar, header, footer, start or end.

A message is one row in a conversation: avatar, header, the surface, footer. align flips the whole row to the other side. Use it in a chat thread, a support inbox, or an AI assistant — wrap a Bubble or any other surface inside.

Scroll to load preview...

Usage

import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar"
import { Bubble, BubbleContent } from "@/components/ui/bubble"
import { Message, MessageAvatar, MessageContent } from "@/components/ui/message"
<Message>
  <MessageAvatar>
    <Avatar>
      <AvatarImage src="https://avatars.githubusercontent.com/u/223274014?s=200&v=4" alt="@shadcnio" />
      <AvatarFallback>SI</AvatarFallback>
    </Avatar>
  </MessageAvatar>
  <MessageContent>
    <Bubble>
      <BubbleContent>How can I help you today?</BubbleContent>
    </Bubble>
  </MessageContent>
</Message>

align="end" is the sent side. The visible surface lives inside MessageContent — usually a Bubble.

Composition

MessageAvatar
MessageHeader
Bubble
MessageFooter

MessageGroup stacks consecutive messages from the same sender.

Avatar

align="end" puts the face on the right. Start is the received side.

Scroll to load preview...

Group

Consecutive sends from one person. An empty MessageAvatar on earlier rows keeps the bubbles in the same column.

Scroll to load preview...

Header is the name. Footer is the timestamp or read receipt — it follows align.

Scroll to load preview...

Actions

Copy, retry, and feedback sit in MessageFooter. Name each icon button.

Scroll to load preview...

Attachment

Files live in MessageContent next to the Bubble — an image going out, a PDF coming back.

Scroll to load preview...

Markdown

Assistant text goes through Markdown. User messages stay plain.

Scroll to load preview...

API

Prop

Type

MessageAvatar, MessageContent, MessageHeader, MessageFooter, and MessageGroup take className. A MessageFooter lifts the avatar so it stays on the surface, not the timestamp. The header stays start-aligned.

Notes

Empty avatars keep the column

Earlier rows in a MessageGroup still need <MessageAvatar />. Without it the bubbles jump left when the last row shows a face.

Icon-only footer buttons need an aria-label. Color is not the failed-send message — put that in the footer text.

With other components

Questions

Was this page helpful?

Sign in to leave feedback.