Skip to content
Thrum

Chat message

One message in a conversation, between people or with an assistant: avatar, author and time, a bubble that keeps line breaks, attachments, the delivery status of what you sent, and actions on hover. It also draws the typing dots and a caret for text that is still streaming in. For a feed of events, use the activity feed.

Install

npx shadcn@latest add @thrum-pro/chat-message

This is a Pro component. The command works once your project has a licence key: set up Pro or see pricing.

Automatically installs icons check, circle-alert, clock and file from the icon set.

Props

PropTypeDefaultDescription
ChatMessage: side"incoming" | "outgoing" | "system"Default "incoming"Who sent it. incoming sits on the start side in the muted colour, outgoing on the end side in the primary colour, system is a centred note with no bubble.
ChatMessage: ...propsComponentProps<"article">–Every other article attribute is passed through. className is merged last.
ChatMessageAvatarComponentProps<"div">–Holds an Avatar at the top of the message. Leave it out for a run of messages from one sender and indent with ps-10.
ChatMessageContentComponentProps<"div">–The column beside the avatar, at most 80% of the row wide, aligned to the sender's side.
ChatMessageHeaderComponentProps<"div">–The row above the bubble for the author and the time.
ChatMessageAuthorComponentProps<"span">–The sender's name, medium weight, cut short with an ellipsis when it does not fit.
ChatMessageTime: dateTimeDate | stringRequiredWhen it was sent. Written into the datetime attribute and, with no children, printed as hours and minutes.
ChatMessageTime: localestringDefault "en-US"The locale of the printed time.
ChatMessageTime: timeZonestring–The time zone of the printed time. Set it when the page renders on a server, so the server and the browser print the same.
ChatMessageBubble: streamingbooleanDefault falseShow a caret after the text while it is still being written.
ChatMessageBubble: typingbooleanDefault falseShow three dots instead of text: the sender is typing.
ChatMessageBubble: typingLabelstringDefault "Typing"What a screen reader hears for the dots: "Mira is typing".
ChatMessageBubble: pausedbooleanDefault falseFreeze the typing dots where they are.
ChatMessageAttachmentsComponentProps<"div">–A wrapping row for files and images sent with the message.
ChatMessageFile: namestringRequiredThe file name. A long name is cut short with an ellipsis; the full name stays in the link's name and its tooltip.
ChatMessageFile: detailstring–Its size or type, after the name: "48 KB".
ChatMessageFile: hrefstring–Where the file opens. Without it the chip is plain text, not a link.
ChatMessageStatus: status"sending" | "sent" | "failed"RequiredWhere an outgoing message is. Each has a word and a glyph: a clock, a tick, a circled exclamation mark.
ChatMessageStatus: onRetry() => void–Shows a Retry button beside a failed status, and is called when it is pressed.
ChatMessageStatus: labels{ sending?, sent?, failed?, retry? }–Replaces the words Sending, Sent, Not sent and Retry.
ChatMessageActionsComponentProps<"div">–Buttons for the message: copy, retry, a reaction. Shown on hover and while the focus is inside the message, and always on touch screens.

Motion and sound

Motion

  • The typing dots rise and fade one after another, once every 1.2 seconds. paused freezes them.
  • The action row fades in over 150 ms when the pointer enters the message or the focus moves into it.
  • Reduced motion: the dots stand still and the actions appear at once.

Sound

Silent. This component makes no sound.

Accessibility

  • Each message is an article. Put the conversation in an element with role="log" and a name, so a screen reader reads new messages as they arrive.
  • The time is a time element with a machine-readable datetime.
  • The delivery status is a word as well as a glyph, in a status region, so a failure is announced. The failed status uses the destructive colour.
  • The typing dots are hidden from screen readers; typingLabel is read in their place, as a status.
  • Line breaks are kept, and long words and links break anywhere, so nothing overflows the bubble at 160 pixels wide.
  • Outgoing text is the primary foreground on the primary colour and incoming text the foreground on the muted colour: both keep 4.5 to 1.
KeysAction
TabMove through the links and buttons of each message: file, Retry, then the actions, which appear as the focus arrives.
Enter / SpacePress the focused button, or open the focused file.

Source

SourcePro

The source comes with Pro

TypeScript source · Copy-paste ready · MIT-compatible for client projects · Includes all dependencies

Files and dependencies

Adds
components/ui/chat-message.tsx
Packages
None
Brings along
Button
Icons
checkcircle-alertclockfile

Changelog

  1. 1.0.0 · 2026-12-03First release.

Loading index…

Keyboard shortcuts

/Ctrl KSearch components, docs and actions
?Show this list
AAppearance studio
SSound on or off
MFull or reduced motion
TTheme: auto, light, dark
GSurface: solid or frosted
BBackdrop photograph (under glass)
CCorner radius: square to round
RReplay the demo, on a component page
DDraw new data, on a component page
←→HomeEndMove the cursor in a focused chart
EscClose a dialog, or leave a chart cursor