Hulian UIv0.93.5413 components0 components
  • Start
  • Components
  • Blocks
  • Pages
  • Demos
  • Changelog
ChineseEnglish
  • ComponentsComponents
  • ThemeTheme

Conversation

  • Conversation
  • ChatMessage
  • PromptInput
  • TypingDots

Reasoning and Tools

  • ThinkingBlock
  • ToolCall
  • AgentPlan
  • Dossier
  • Artifact
  • ConfirmCard
  • ThreadList
  • TaskRunner

Assistance

  • StreamingText
  • PromptSuggestions
  • MessageActions
  • Citation

ChatMessage

chat-message

Displays one chat turn with role, content, status, and supporting actions.

Usage

Users and Assistants

role determines the alignment and bubble background color: user right-aligned primary bottom / assistant left-aligned surface bottom. name appears above the text.

Me
Me
Help me rewrite the homepage to 100% dogfood
AI
Hulian AI
Okay, let me take a look at the existing structure before starting.
tsx
<>
  <ChatMessage role="user" name="Me">Help me rewrite the homepage to 100% dogfood</ChatMessage>
  <ChatMessage role="assistant" name="Hulian AI">Okay, let me take a look at the existing structure before starting.</ChatMessage>
</>

Loading state

While the agent is responding, loading renders TypingDots in the message body and ignores placeholder children.

AI
Hulian AI
tsx
<ChatMessage role="assistant" name="Hulian AI" loading>Placeholder</ChatMessage>

Read receipt

status Only in role=user (right bubble) Rendering: sending circle / sent single hook / read double blue hook.

Me
Agent·Xiao LianJust now
A work order has been submitted for you.
Me
Agent·Xiao LianJust now
Refunds are expected to arrive in 1-3 working days.
tsx
<>
  <ChatMessage role="user" name="Agent·Xiao Lian" timestamp="Just now" status="sent">A work order has been submitted for you. </ChatMessage>
  <ChatMessage role="user" name="Agent·Xiao Lian" timestamp="Just now" status="read">Refunds are expected to arrive in 1-3 working days.</ChatMessage>
</>

Avatar and operation area

avatar slot customization <Avatar/>, actions slot <MessageActions/> (copy/like/dislike, etc., press callback and content to show or hide).

Lian
Hulian AI
Completed home page rewrite, 100% dogfood @hulianui/ui.
tsx
<ChatMessage
  role="assistant"
  name="Hulian AI"
  avatar={<Avatar fallback="Lian" />}
  actions={
    <MessageActions
      content="Home page rewriting completed"
      onLike={() => {}}
      onDislike={() => {}}
    />
  }
>
  Completed home page rewrite, 100% dogfood @hulianui/ui.
</ChatMessage>

System Announcement

role=system is centered and weakened, does not enter the bubble/avatar system, and is used for switching prompts, etc.

Switched to Opus 4.8
tsx
<ChatMessage role="system">Switched to Opus 4.8</ChatMessage>

When to Use

Render one user or assistant message, or a centered system notice. Use Conversation for a scrolling message history and place MessageActions in the actions slot for controls below the bubble.

Avatar fallback copy and receipt accessibility labels follow the nearest ConfigProvider locale (zhCN by default, or enUS).

Import

ts
import { ChatMessage } from "@hulianui/ui"

Props

Inherited from Omit<HTMLAttributes<HTMLDivElement>, "title">.

NameTypeDefaultDescription
role *"user" | "assistant" | "system""assistant" (showcase)User messages are right-aligned on a primary background, assistant messages are left-aligned on a surface background, and system notices are centered and muted
loadingbooleanfalseReplaces the message body with TypingDots while the assistant response is being generated
status"sending" | "sent" | "read"-User-only receipt: spinner with "\u53d1\u9001\u4e2d" (Sending), one check with "\u5df2\u9001\u8fbe" (Delivered), or two blue checks with "\u5df2\u8bfb" (Read) as the built-in aria-label

Slots

SlotTypeDescription
childrenReactNodeMessage body; pass plain text directly or wrap rendered Markdown in <Prose />
avatarReactNodeAvatar slot, typically a Hulian <Avatar/>; omitted avatars use "\u6211" (Me) for user or "AI" for assistant, while system messages render no avatar
nameReactNodeSender’s name (above the text)
timestampReactNodeTimestamp (right side of name, weakened color)
actionsReactNodeAction area below the bubble, typically <MessageActions/>

Usage Guidelines

  • status receipts render only for role="user"; assistant and system messages ignore them.
  • When loading is true, the text is replaced by TypingDots. children is only a placeholder and not displayed.

Related

Conversation · PromptInput · TypingDots · ThinkingBlock · ToolCall · AgentPlan

Playground

AI
Hello, how can I help you?
<ChatMessage role="assistant">Hello, how can I help you?</ChatMessage>
PreviousConversationAI AgentsNextPromptInput

On this page

  • Usage
  • Documentation
    • When to Use
    • Import
    • Props
    • Slots
    • Usage Guidelines
    • Related
  • Playground