Uai

aimessage.tsx

Color theme

component · 02/108

Message

User, assistant, system, and tool messages with replaceable content.

Install

Install manuallyView source on GitHub

Anatomy

  • Message
  • MessageBody
  • MessageContent
  • MessageAvatar
  • MessageHeader
  • MessageAuthor
  • MessageTime
  • MessageActions
  • MessageCopy
  • MessageAction

Accessibility4 checks

  • Each message is an article named by its author role; streaming messages set aria-busy until content settles.
  • Wrap a conversation in a role="log" container so new messages are announced politely.
  • Icon-only actions require a label; Copy confirms through a visually hidden status message.
  • Actions are hidden while streaming, and the streaming caret is decorative and stops blinking under reduced motion.
canvasvariant="bubble"ai
AI and automation
Conversation shared with the billing team.
Maya Ruiz
If I downgrade today, do I lose shared workspaces right away?
billing.get_subscription
plan: pro · renews: 2026-10-14 · seats: 6
Assistant
Your Pro plan renews on October 14. Downgrading takes effect at the end of the billing period, so you keep shared workspaces until then.
message variant

Code example

usage.tsx
"use client";import { RotateCw, ThumbsUp } from "lucide-react";import { useEffect, useState } from "react";import {  Message,  MessageAction,  MessageActions,  MessageAuthor,  MessageAvatar,  MessageBody,  MessageContent,  MessageCopy,  MessageHeader,  MessageTime,  type MessageVariant,} from "@/components/ui/uai/message";const reply =  "Your Pro plan renews on October 14. Downgrading takes effect at the end of the billing period, so you keep shared workspaces until then.";export function MessagePreview({ variant = "bubble" }: { variant?: MessageVariant }) {  const [shown, setShown] = useState(reply.length);  const streaming = shown < reply.length;  useEffect(() => {    if (!streaming) return;    const timer = window.setTimeout(() => setShown((count) => count + 6), 40);    return () => window.clearTimeout(timer);  }, [streaming]);  return (    <div role="log" aria-label="Billing conversation" style={{ display: "grid", gap: 20 }}>      <Message variant={variant} from="system">        <MessageBody>          <MessageContent>Conversation shared with the billing team.</MessageContent>        </MessageBody>      </Message>      <Message variant={variant} from="user">        <MessageAvatar>MR</MessageAvatar>        <MessageBody>          <MessageHeader>            <MessageAuthor>Maya Ruiz</MessageAuthor>            <MessageTime dateTime="2026-09-30T09:12">9:12</MessageTime>          </MessageHeader>          <MessageContent>            If I downgrade today, do I lose shared workspaces right away?          </MessageContent>        </MessageBody>      </Message>      <Message variant={variant} from="tool">        <MessageAvatar />        <MessageBody>          <MessageHeader>            <MessageAuthor>billing.get_subscription</MessageAuthor>          </MessageHeader>          <MessageContent>plan: pro · renews: 2026-10-14 · seats: 6</MessageContent>        </MessageBody>      </Message>      <Message variant={variant} from="assistant" streaming={streaming}>        <MessageAvatar />        <MessageBody>          <MessageHeader>            <MessageAuthor />            <MessageTime dateTime="2026-09-30T09:12">9:12</MessageTime>          </MessageHeader>          <MessageContent>{reply.slice(0, shown)}</MessageContent>          <MessageActions>            <MessageCopy />            <MessageAction label="Good response">              <ThumbsUp size={14} aria-hidden="true" />            </MessageAction>            <MessageAction label="Regenerate response" onClick={() => setShown(0)}>              <RotateCw size={14} aria-hidden="true" />            </MessageAction>          </MessageActions>        </MessageBody>      </Message>    </div>  );}

Manual installation

message.tsx

Loading component source…

esc
ThinkingAI
MessageAI
CitationAI
AttachmentAI
Tool CallAI
Response StatusAI
Run SummaryAI
Conversation ThreadAI · Block
Research SessionAI · Block
File AnalysisAI · Block
Agent RunAI · Block
Approval CardFeedback
Empty StateFeedback
Status BannerFeedback
Progress SummaryFeedback
Inline FeedbackFeedback
Confirmation DialogFeedback
Activity TimelineFeedback
Skeleton GroupFeedback
Prompt ComposerForms
Form FieldForms
Search FieldForms
Filter BarForms
File UploadForms
Date Range PickerForms
Form Error SummaryForms
Unsaved Changes BarForms
Step IndicatorForms
Task ListData Display
Data Table ToolbarData Display
Metric CardData Display
Description ListData Display
Comparison TableData Display
Kanban BoardData Display
Calendar ViewData Display
Audit LogData Display
App HeaderNavigation
App SidebarNavigation
Breadcrumb TrailNavigation
Page TabsNavigation
Command MenuNavigation
Split PaneNavigation
Sign-in CardAuthentication
Sign-up CardAuthentication
Password RecoveryAuthentication
Code VerificationAuthentication · Block
Onboarding WizardAuthentication · Block
Workspace SetupAuthentication · Block
Coupon FieldCommerce
Quantity PickerCommerce
Cart ItemCommerce
Price SummaryCommerce
Order StatusCommerce
Product DetailCommerce · Block
Product ListingCommerce · Block
Cart DrawerCommerce · Block
CheckoutCommerce · Block
Order TrackingCommerce · Block
Subscription ManagementCommerce · Block
Announcement BarMarketing
Pricing ToggleMarketing
Testimonial CardMarketing
Product GalleryMarketing
Trust PanelMarketing
Newsletter FormMarketing
Hero SectionMarketing · Block
Feature ShowcaseMarketing · Block
Pricing SectionMarketing · Block
Testimonials SectionMarketing · Block
FAQ SectionMarketing · Block
Call to ActionMarketing · Block
Waitlist SectionMarketing · Block
Contact SectionMarketing · Block
Author CardContent
CommentContent
Reaction BarContent
Share MenuContent
Changelog EntryContent
Article PageContent · Block
Documentation PageContent · Block
Changelog PageContent · Block
Comment ThreadContent · Block
Community FeedContent · Block
Public ProfileContent · Block
Map FrameMaps
Map ControlsMaps
Map MarkerMaps
Map LegendMaps
Place CardMaps
Route SummaryMaps
Dashboard ShellApplication · Block
Settings PageApplication · Block
Profile PageApplication · Block
Team ManagementApplication · Block
Notification CenterApplication · Block
Billing PortalApplication · Block
Search ResultsApplication · Block
Resource ManagerOperations · Block
Data ExplorerOperations · Block
Import WorkflowOperations · Block
Approval QueueOperations · Block
Audit Log ViewerOperations · Block
Incident DashboardOperations · Block
Report BuilderOperations · Block
Document FieldBrazil
CEP FieldBrazil
Pix PaymentBrazil
Installment PickerBrazil