Skip to main content

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​

Storybook

Outgoing​

Storybook

AI​

Storybook

System​

Storybook

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​

VariantWhat it is
insurface with border, author and avatar.
outprimary fill, status (Sent, Read).
aiAI purple tint and AI tag.
systemCentered 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​

PropTypeDefaultDescription
direction'in' | 'out''in''in' (received, left) | 'out' (sent, right)
authorstringnoneSender name, shown with an avatar on incoming messages
time *string—Time sent, e.g. "9:02 AM"
statusstringnoneDelivery status, outgoing only ("Sent", "Read")
aibooleanfalseMessage written by an AI agent: purple bubble and AI tag
systembooleanfalseSystem 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>
KindNameDescription
attributedirection'in' (received, left) | 'out' (sent, right); default 'in'
attributeauthorSender name, shown with an avatar on incoming messages; default none
attributetimeTime sent, e.g. "9:02 AM"
attributestatusDelivery status, outgoing only ("Sent", "Read"); default none
attributeaiMessage written by an AI agent: purple bubble and AI tag; default false
attributesystemSystem event ("Henna West started a conversation"); default false
attributedefault-checked / defaultChecked
property / JSON attributedefault-value / defaultValue
attributeauto-focus / autoFocus
slot(default)Message text