Skip to content

Chat Bubble ​

The right-aligned bubble of a sent message. Plain text, or rich content with inline media tags; long messages clamp behind a fade with an Expand/Collapse toggle, and a copy action appears below on hover.

Examples ​

Plain, rich & collapsible ​

moonbit
@sumi.chat_bubble(text="Continue")
@sumi.chat_bubble(children=[
  @sumi.media_tag(kind=@sumi.Image, variant=@sumi.Inline, thumbnail=thumb),
  @html.text("Add more detail"),
])
@sumi.chat_bubble(
  text=long,
  collapsible=true,
  collapsed=c,
  on_toggle=set_c.map(v => _ => !v),
  on_copy=copy_it,
)

API ​

chat_bubble ​

NameTypeDefaultDescription
textString—Plain-text content (mutually exclusive with children)
childrenArray[Html]—Rich content row: inline media tags + text spans
collapsibleBoolfalseEnables the clamp + Expand/Collapse toggle
collapsedBooltrueControlled clamp state
on_toggleCmd—Expand/Collapse click command
collapse_linesInt9Lines kept when collapsed (default 9)
on_copyCmd—Copy action revealed below the bubble on hover
aria_labelString—
idString—Element id
classString—Extra class names
attrsAttrs—Extra HTML attributes
styleArray[String][]Extra inline styles

* required (labelled) parameter — everything else is optional.