Faber UI
Components

Message

A chat-style message row with avatar and content slots.

Message is a chat-style message row. It pairs an avatar with a header, content, and footer, and supports left or right alignment. Put Bubble inside MessageContent for the message body.

Installation

Terminal
pnpm dlx shadcn@latest add https://faber-ui.vercel.app/r/message.json

Usage

typescript
import { Avatar, AvatarFallback } from "@/components/ui/avatar";
import { Bubble, BubbleContent } from "@/components/ui/bubble";
import {
  Message,
  MessageAvatar,
  MessageContent,
  MessageGroup,
  MessageHeader,
} from "@/components/ui/message";

export default function Example() {
  return (
    <MessageGroup>
      <Message>
        <MessageAvatar>
          <Avatar>
            <AvatarFallback>AB</AvatarFallback>
          </Avatar>
        </MessageAvatar>
        <MessageContent>
          <MessageHeader>Anna</MessageHeader>
          <Bubble variant="muted">
            <BubbleContent>Hello there!</BubbleContent>
          </Bubble>
        </MessageContent>
      </Message>
    </MessageGroup>
  );
}

Examples

Default

AB
Anna
Are we still on for the design review?
ME
You
Yes, 3 PM in the studio.

Consecutive bubbles

Stack several bubbles in one MessageContent when the same person sends messages back to back. The avatar sits beside the last one.

AB
Anna
Just landed.
Grabbing a cab now, see you in twenty minutes.

Use MessageFooter for timestamps and delivery status. The avatar stays aligned with the last bubble, not the footer.

AB
Anna
Can you send the latest mockups?
10:41 AM
ME
Uploading them now.
10:42 AM

API

Each part forwards every prop of what it is built on, including className and render where Base UI supports it. The props column lists only what Faber UI adds on top.

PartBuilt onProps
MessageGroupdata-slot="message-group"<div>HTML—
Messagedata-slot="message"<div>HTML
  • align? = "start""start" | "end"
MessageAvatardata-slot="message-avatar"<div>HTML—
MessageContentdata-slot="message-content"<div>HTML—
MessageHeaderdata-slot="message-header"<div>HTML—
MessageFooterdata-slot="message-footer"<div>HTML—

Changelog

  1. v0.3.0MessageAvatar lines up with the last bubble when a MessageFooter is present, instead of sitting 8px too high.patch
Full Message history

Last updated on

On this page