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

MessageActions

message-actions

Groups copy, retry, rate, and related controls for a chat message.

Usage

Full set of operations

Provides content + each callback, rendering copy/regenerate/like/dislike four keys.

tsx
<MessageActions
  content="Hulian supports light and dark dual themes with 0 flicker."
  onRegenerate={() => regenerate()}
  onLike={() => rate("up")}
  onDislike={() => rate("down")}
/>

Copy only

When only transmitting content, the copy button is displayed separately. After clicking, Check returns 1.5s.

tsx
<MessageActions content="Read-only fragment, for copying only." />

Add custom keys

children Append any operation (such as collection, sharing) at the end.

tsx
<MessageActions content={text} onRegenerate={regen}>
  <button
    type="button"
    className="inline-flex h-7 items-center rounded-[var(--radius)] px-2 text-xs text-muted-foreground hover:bg-surface-hover hover:text-foreground"
  >
    Favorite
  </button>
</MessageActions>

hangs under ChatMessage

The actions slot as ChatMessage, with the following bubble displayed below the message.

AI
Hulian AI
Yes. Light and dark themes render without a flash because SSR injects variables before first paint.
tsx
<ChatMessage
  role="assistant"
  name="Hulian AI"
  actions={<MessageActions content={text} onRegenerate={regen} onLike={up} onDislike={down} />}
>
  Yes. Light and dark themes render without a flash because SSR injects variables before first paint.
</ChatMessage>

When to Use

Place it beneath a generated assistant message to provide copy, regenerate, like, and dislike controls, typically through the actions slot of ChatMessage. Unlike PromptSuggestions, which guides the next question, MessageActions handles feedback and reuse for the current message. Each button appears only when its content or callback is provided.

Import

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

Props

Inherits HTMLAttributes<HTMLDivElement>, additionally:

NameTypeDefaultDescription
contentstring-Text copied by the built-in clipboard action; providing it displays the copy button and 1.5-second success feedback

Events

EventTypeDescription
onCopy() => voidCalled after the built-in clipboard action; providing it also displays the copy button
onRegenerate() => voidCalled when regenerate is selected; providing it displays the button
onLike() => voidCalled when like is selected; providing it displays the button
onDislike() => voidCalled when dislike is selected; providing it displays the button

Slots

SlotTypeDescription
childrenReactNodeAdditional custom action controls

Usage Guidelines

  • Buttons render on demand: the copy button appears when content or onCopy is present; the remaining buttons appear when their corresponding callbacks are provided.
  • Copying uses the Clipboard API and shows a checkmark for 1.5 seconds. onCopy runs in parallel for analytics or toast handling, so callers do not need to invoke navigator.clipboard again.
  • Built-in accessible labels are Chinese: \u5df2\u590d\u5236 ("Copied"), \u590d\u5236 ("Copy"), \u91cd\u65b0\u751f\u6210 ("Regenerate"), \u8d5e ("Like"), and \u8e29 ("Dislike").

Related

StreamingText · PromptSuggestions · Citation · Conversation · ChatMessage · PromptInput

PreviousPromptSuggestionsAI AgentsNextCitation

On this page

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