Skip to main content

Message Actions

Action buttons for chat messages (copy, regenerate, edit, share, feedback). Provides a consistent interface for common message operations in chat applications.

Preview

Installation

Terminalbash

Usage

Reacttsx

Examples

Full Featured

tsx

For Assistant Messages

Typical actions for AI assistant responses:

tsx

For User Messages

Typical actions for user messages:

tsx

Compact Mode (Icon Only)

Use compact mode for space-constrained layouts:

tsx

Props

NameTypeDefaultDescription
showCopy
booleantrueShow copy button
showRegenerate
booleanfalseShow regenerate button
showEdit
booleanfalseShow edit button
showShare
booleanfalseShow share button
showFlag
booleanfalseShow flag/report button
showFeedback
booleanfalseShow feedback buttons (thumbs up/down)
onCopy
() => voidCallback when copy is clicked
onRegenerate
() => voidCallback when regenerate is clicked
onEdit
() => voidCallback when edit is clicked
onShare
() => voidCallback when share is clicked
onFlag
() => voidCallback when flag is clicked
onThumbsUp
() => voidCallback when thumbs up is clicked
onThumbsDown
() => voidCallback when thumbs down is clicked
isRTL
booleanfalseWhether text direction is RTL
compact
booleanfalseCompact mode (icon only)

Accessibility

Screen Reader

All buttons include screen reader labels via sr-only spans, ensuring icon-only buttons are accessible. Feedback state changes are announced appropriately.

Keyboard Navigation

  • Tab: Navigate between action buttons
  • Enter or Space: Activate button

Visual Feedback

Copy button shows a checkmark when clicked. Feedback buttons change color when selected, providing clear visual feedback for user actions.

RTL Considerations

The action buttons work seamlessly in RTL layouts. Button labels appear in the correct language and icon spacing adapts automatically.

LTR (English)

RTL (العربية)

Related Components

Chat Message

Display chat messages with actions

Prompt Input

Input component for sending messages

Thinking Indicator

Loading state for AI responses