ChatMessage
BasicMobile
<co-chat-message>ChatMessage is one bubble in a secure message thread: incoming, outgoing, AI or system.
import { ChatMessage } from 'health-components';
Examples
Thread
Outgoing
AI
System
Usage
<ChatMessage author="Henna West" time="9:02 AM">Can I get my refill before Friday?</ChatMessage>
<ChatMessage direction="out" time="9:40 AM" status="Read">Approved.</ChatMessage>
When to use
- Patient and staff messaging, AI receptionist transcripts.
When not to use
- Clinical notes.
Variants and states
| Variant | What it is |
|---|---|
| in | surface with border, author and avatar. |
| out | primary fill, status (Sent, Read). |
| ai | AI purple tint and AI tag. |
| system | Centered grey line. |
Accessibility
- Author and time are text, not only position.
Do and don't
- Do: Mark AI replies with the AI tag.
- Don't: Send PHI in push previews.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
direction | 'in' | 'out' | 'in' | 'in' (received, left) | 'out' (sent, right) |
author | string | none | Sender name, shown with an avatar on incoming messages |
time * | string | — | Time sent, e.g. "9:02 AM" |
status | string | none | Delivery status, outgoing only ("Sent", "Read") |
ai | boolean | false | Message written by an AI agent: purple bubble and AI tag |
system | boolean | false | System event ("Henna West started a conversation") |
children * | ReactNode | — | Message text |
Also accepts native attributes, including defaultChecked, defaultValue, autoFocus, plus className and event handlers on the root element.
Angular, Vue and HTML
Register the elements once (Angular guide), then use <co-chat-message>. Attributes take strings; arrays and objects are set as properties (Angular [prop], Vue :prop) or as JSON attributes. Callbacks are DOM events with the value in event.detail.
Angular template
<co-chat-message direction="…" author="…" [defaultValue]="defaultValue">…</co-chat-message>
| Kind | Name | Description |
|---|---|---|
| attribute | direction | 'in' (received, left) | 'out' (sent, right); default 'in' |
| attribute | author | Sender name, shown with an avatar on incoming messages; default none |
| attribute | time | Time sent, e.g. "9:02 AM" |
| attribute | status | Delivery status, outgoing only ("Sent", "Read"); default none |
| attribute | ai | Message written by an AI agent: purple bubble and AI tag; default false |
| attribute | system | System event ("Henna West started a conversation"); default false |
| attribute | default-checked / defaultChecked | |
| property / JSON attribute | default-value / defaultValue | |
| attribute | auto-focus / autoFocus | |
| slot | (default) | Message text |