Message
A single message row displaying text content with an optional trailing delivery status icon. Used within conversation threads to represent individual messages.
Group messages from the same sender under a MessageHeader, and indent the group yourself — Message does not apply its own left margin.
Quick Start
- Installation
npm install @adaptavant/eds-core- Import
import { Message } from '@adaptavant/eds-core';
Status
The status prop controls the trailing icon and its color.
<Stack className="gap-2 w-full">
<Message status="sending">This message is sending</Message>
<Message status="sent">This message has been sent</Message>
<Message status="delivered">This message has been delivered</Message>
<Message status="read">This message has been read</Message>
</Stack>
Custom trailing content
Pass railEnd to replace the default status icon with custom trailing content.
<Message railEnd={<DeleteIcon size="16" tone="neutralTertiary" />}>This message is not needed</Message>
Failed
When status is "failed", the message uses a critical background. Provide a retry control through railEnd.
<Message status="failed">This message failed to send</Message>
With header
Group several messages under a MessageHeader. Indent the message stack to align with the sender name.
<Stack className="w-full">
<MessageHeader avatar={{ name: 'Robert' }} timestamp="8:02 AM" />
<Stack className="w-full ps-6">
<Message status="delivered">This is a placeholder message</Message>
<Message status="delivered">This is a placeholder message</Message>
<Message status="delivered">This is a placeholder message</Message>
</Stack>
</Stack>
API Reference
Message
| Prop | Default | Description |
|---|---|---|
children | _ | ReactNodeThe message content. |
as? | 'div' | 'div' | 'p' | 'span'The element type used for the content wrapper. |
status? | _ | 'sending' | 'sent' | 'delivered' | 'read' | 'failed'The delivery status of the message. Controls the default trailing icon and background ( failed uses a critical background). |
railEnd? | _ | ReactNodeCustom trailing content. When provided, replaces the default status icon. |
isHovered? | _ | booleanApplies a controlled hover background when true. |
isPinned? | _ | booleanApplies a pinned background. |
isSelected? | _ | booleanApplies a selected background. |
Style API
Our design system components include style props that allow you to easily customize different parts of each component to match your design needs.
Please refer to the Style API documentation for more insights.
Message parts
<Message
classNames={{
content: 'text-secondary',
statusIcon: 'text-critical'
}}
status="read"
>
Hello, how can I help you?
</Message>
| Part | Description |
|---|---|
root | The message row container. |
content | The wrapper around the message children. |
statusIcon | The trailing status icon or custom railEnd content. |