Messaging components

Powerful and customizable React messaging components built for modern applications and websites. These messaging components are built using React Aria and styled with Tailwind CSS.

Get the code
  1. Lana Steiner
    Lana Steiner
    Hey team, I've finished with the requirements doc!
  2. Lana Steiner
    Lana Steiner

    Tech requirements.pdf

    1.2 MB

  3. You
    Awesome! Thanks.
  4. Demi Wilkinson
    Demi Wilkinson
    Good timingโ€”was just looking at this.
  5. Today
  6. Phoenix Baker
    Phoenix Baker
    Hey Olivia, can you please review the latest design when you can?
  7. You
    Sure thing, I'll have a look today.

Installation

Messaging component depends on other components to function properly. Before using them, make sure to add the required components via CLI.

Use the following command to install them:

npx untitledui@latest add messaging

Message status

In order to display the message status separately, you can use the MessageStatus component. It accepts the status prop which can be one of the following:

  • sent
  • read
  • failed

Optionally, you can also pass the readAt prop to display the date and time when the message was read.

Message action examples

Below are examples and variations of this message action component:

Get the code
Olivia Rhye

Olivia

Message examples

Below are examples and variations of this message component:

Get the code
  1. Phonenix Baker
    Phonenix Baker
    Hey Olivia, can you please review the latest design when you can?
Get the code
  1. Phonenix Baker
    Phonenix Baker
    Hey Olivia, can you please review the latest design when you can?
    • โค๏ธ
    • ๐Ÿ‘Œ2
Get the code
  1. Phonenix Baker
    Phonenix Baker
    Sure thing, I'll have a look today.
    Awesome, thanks!
Get the code
  1. Phonenix Baker
    Phonenix Baker

    Latest design screenshot.jpg

    1.2 MB

Get the code
  1. Phonenix Baker
    Phonenix Baker

    00:28

Get the code
  1. Phonenix Baker
    Phonenix Baker
    Latest design screenshot
    Latest design screenshot.jpg128 KB
Get the code
  1. Phonenix Baker
    Phonenix Baker

API reference

MessageItem

Import MessageItem from @/components/application/messaging/messaging. Renders a <li> element.

MessageItem props
PropTypeDefaultDescription
msg* (required)Messageโ€”The message to render. Its populated fields decide which bubble is drawn โ€” text, image, audio, attachment, reply quote, URL preview, reactions or typing indicator.
showUserLabelbooleantrueWhether to show the sender's name above the bubble. Turn it off for consecutive messages from the same person.

Also accepts all standard list item attributes, all standard HTML attributes, all aria-* attributes, all standard React DOM event handlers.

MessageStatus

Import MessageStatus from @/components/application/messaging/messaging. Renders Tooltip.

MessageStatus props
PropTypeDefaultDescription
status* (required)
"sent""read""failed"
โ€”Delivery state of the message โ€” a single tick for "sent", a double tick for "read", or an error circle for "failed".
readAtstringโ€”When the message was read. Appended to the tooltip for the "read" status.

FAQs

Please refer to our frequently asked questions page for more.

MessageItem takes a single msg prop typed as Message. Only id is required; everything else is optional โ€” text, sentAt, readAt, status, typing, a user object, and the content payloads image, audio, attachment, reply, urlPreview and reactions. reply and urlPreview only render on a message that also has text. Because MessageItem renders an <li>, map your messages inside your own <ol> or <ul> and give that list an aria-label such as "Conversation".

Set me: true inside the message's user object. The bubble then aligns to the right with self-end, uses the primary background with a squared top-right corner, and the sender label reads "You" instead of user.name. Avatars are only rendered for messages from other people.

Set status on the message to "sent", "read" or "failed" and the status icon renders next to the timestamp. Add readAt and it is appended to the tooltip on a read message. You can also render the indicator on its own with <MessageStatus status="read" readAt="2:20 PM" /> โ€” the message status example above renders all three states that way.

Yes. Pass image as { src, alt, name, size }, attachment as { name, size, type } where type is one of "jpg", "txt", "pdf" or "mp4" (it selects the file icon), and audio as { duration }, which renders a waveform with a play button. size and duration are display strings, not raw byte counts, and the audio playback button is a UI shell โ€” wire up your own player.

Add an entry with typing: true and no text or other content, since any content would still render above the dots. MessageItem renders the animated three-dot bubble and hides the timestamp and status for that entry; the sender label still shows unless you set showUserLabel={false}.

Pass showUserLabel={false} to MessageItem. It defaults to true, so a common pattern is to only show the label on the first message in a run from the same sender.

The composers are example code rather than exported components โ€” MessageActionMinimal, MessageActionTextarea and MessageActionAdvanced live in message-action.demo.tsx, so copy the one you want into your own project rather than importing it as part of the API. All three are uncontrolled forms with a field named message: they accept an onSubmit callback that is called with the message string after the form's default submission is prevented, and MessageActionMinimal additionally accepts a size of "sm", "md" or "lg", defaulting to "lg".