Usage
Chat Message Bubble presents a single consumer-owned fragment inside a Chat Message. See the Chat family guide for complete turn and conversation composition.
import "@nordhealth/components/lib/ChatMessageBubble"
Composition
Chat Message Bubble is a presentational fragment within Chat Message. It inherits sender and density context from the surrounding turn, owns the surface variant and grouping treatment, and leaves the semantics and behavior of its consumer content unchanged.
Examples
Variants and grouping
Use variant="filled", ghost, or error to match the message state. For consecutive fragments from one sender, set group to first, middle, and last; only the sender-side corners tighten. Sender alignment and compact, balanced, or spacious density are inherited from the nearest Chat Message unless explicitly overridden.
Filled incoming messages use the standard Nord surface and strong border. Outgoing messages use the weak information surface and information border, with the flat corner mirrored using logical properties in RTL. The default message measure is 20rem; override --n-chat-message-bubble-max-inline-size when a product needs a different conversation measure.
Accessibility
The bubble is presentational and does not replace the semantics of its content. Keep links, controls, lists, and structured text as real elements inside it. Error treatment includes semantic text/color roles, but the message copy should still explain the failure without relying on color alone.
Templates
See this component composed into complete application views:
API reference
ChatMessageBubble
Chat Message Bubble styles one consumer-owned message fragment using sender and density values inherited privately from Chat Message.
<nord-chat-message-bubble></nord-chat-message-bubble>Props
| Property | Attribute | Description | Type | Default |
|---|---|---|---|---|
variant | variant | Visual treatment for the bubble. | ChatMessageBubbleVariant | 'filled' |
group | group | Position within a consecutive group of bubbles from the same sender. | ChatMessageBubbleGroup | undefined | — |
Slots
| Slot name | Description |
|---|---|
Default slot | Message content. |
CSS Properties
CSS Custom Properties provide more fine grain control over component presentation. We advise utilizing existing properties on the component before using these.
| Property | Description | Default |
|---|---|---|
--n-chat-message-bubble-max-inline-size | Maximum message measure. | 70ch |
--n-chat-message-bubble-padding | Inner message spacing. | var(--n-space-s) var(--n-space-m) |
--n-chat-message-bubble-border-width | Message border width. | 1px |
--n-chat-message-bubble-border-style | Message border style. | solid |
--n-chat-message-bubble-border-color | Message border color. | var(--n-color-border-strong) |
--n-chat-message-bubble-border-radius | Message corner radius. | var(--n-border-radius) |
--n-chat-message-bubble-connected-border-radius | Corner radius where grouped messages connect. | var(--n-border-radius-sharp) |
--n-chat-message-bubble-background | Message surface color. | var(--n-color-surface) |
--n-chat-message-bubble-color | Message text color. | var(--n-color-text) |