Bubble

Displays conversational content in a message bubble. Supports variants, alignment, grouping, reactions, and collapsible content.

Hey there! what's up?
Hey! Want to see chat bubbles?
I can group messages, switch sides, and keep the whole thread easy to scan.
Sure. Hit me with your best demo.
Yes. You are reading a demo that is demoing itself. Very meta. Very on-brand.

Installation

ng g @spartan-ng/cli:ui bubble

Usage

import { HlmBubbleImports } from '@spartan-ng/helm/bubble';
<div hlmBubble>
  <div hlmBubbleContent>How can I help you today?</div>
</div>

Compose Bubble inside Message for conversation rows. Place avatars, names, timestamps, and message-level actions on Message .

Examples

Variants

This is the default primary bubble.
This is the secondary variant.
This one is muted. It uses a lower emphasis color for the chat bubble.
This one is tinted. The tint is a softer color derived from the primary color.
We can also use an outlined variant.
Or a destructive variant with a reaction.

Ghost bubbles work for assistant text, markdown , and other content that should not be framed.

This is perfect for assistant messages that should not have a frame and can take the full width of the container. You can also render code in it.

Ghost bubbles are full width and can take the full width of the container.

Alignment

Use align on hlmBubble to align the bubble. For chat UIs, prefer alignment on Message .

This bubble is aligned to the start. This is the default alignment.
This bubble is aligned to the end. Use this for user messages.

Bubble Group

Use hlmBubbleGroup to group consecutive bubbles from the same sender. Set align on each hlmBubble , not the group.

Can you tell me what's the issue?
You tell me!
It worked yesterday. You broke it!
Find the bug and fix it.
Want me to diff yesterday's you against today's you? It's a bit embarrassing.

Put hlmBubbleContent on a button or a to make the bubble interactive.

How can I help you today?

Reactions

Use hlmBubbleReactions for emoji reactions or quick actions. Reactions overlap the bubble edge, so leave vertical space between rows.

I don't need tests, I know my code works.
Bold. Fine I'll add some tests. I'll let you know when they're done.
Tests passed on the first try. All 142 of them. Looking good!
Are you sure I can run this command?

Show More / Collapsible

How can I help you today?
The accessibility review found two focus states that were visually too subtle in dark mode. I checked the dialog, menu, and drawer paths because each one renders focusable control...

Tooltip

Did you remove the stale route?
Yes, removed it from the registry.

Popover

Run the build script.
Failed to run the command.

RTL

To enable RTL support in spartan-ng, see the RTL configuration guide.

هذه الفقاعة محاذاة إلى البداية. هذا هو المحاذاة الافتراضية.
هذه الفقاعة محاذاة إلى النهاية. استخدم هذا لرسائل المستخدم.

Helm API

HlmBubbleContent

Selector: [hlmBubbleContent],hlm-bubble-content

HlmBubbleGroup

Selector: [hlmBubbleGroup],hlm-bubble-group

HlmBubbleReactions

Selector: [hlmBubbleReactions],hlm-bubble-reactions

Inputs

PropTypeDefaultDescription
side BubbleReactionsVariants['side'] 'bottom' -
align BubbleReactionsVariants['align'] 'end' -

HlmBubble

Selector: [hlmBubble],hlm-bubble

Inputs

PropTypeDefaultDescription
variant BubbleVariants['variant'] 'default' -
align BubbleAlign 'start' -
Button Breadcrumb