Message

A row of a conversation: an avatar beside its bubbles, a sender above, a status or actions below. In the look of the app's style.

Data DisplayExperimental

Usage

import { Component, ViewEncapsulation } from '@angular/core';import {  ScAvatar,  ScAvatarFallback,  ScBubble,  ScBubbleContent,  ScMessage,  ScMessageAvatar,  ScMessageContent,  ScMessageFooter,  ScMessageHeader,} from '@semantic-components/ui';
@Component({  selector: 'app-message-usage-demo',  imports: [    ScAvatar,    ScAvatarFallback,    ScBubble,    ScBubbleContent,    ScMessage,    ScMessageAvatar,    ScMessageContent,    ScMessageFooter,    ScMessageHeader,  ],  template: `    <div class="flex w-full max-w-sm flex-col gap-6 py-6">      <div scMessage>        <div scMessageAvatar>          <span scAvatar><span scAvatarFallback>OM</span></span>        </div>        <div scMessageContent>          <div scMessageHeader>Olivia</div>          <div scBubble variant="muted">            <div scBubbleContent>              The build failed during dependency installation.            </div>          </div>        </div>      </div>      <div scMessage alignment="end">        <div scMessageAvatar>          <span scAvatar><span scAvatarFallback>ME</span></span>        </div>        <div scMessageContent>          <div scBubble>            <div scBubbleContent>Can you share the exact error?</div>          </div>          <div scMessageFooter>Read 10:42</div>        </div>      </div>    </div>  `,  host: { class: 'flex w-full justify-center' },  encapsulation: ViewEncapsulation.None,})export class MessageUsageDemo {}

Anatomy

Every part is a directive on your element; the bubbles, the avatar and every word are yours. The layout is the message's; the bubble's look is Bubble's.

import {  ScMessageGroup, ScMessage, ScMessageAvatar, ScMessageContent,  ScMessageHeader, ScMessageFooter,} from '@semantic-components/ui';
<div scMessageGroup>  <div scMessage alignment="…">    <div scMessageAvatar>…</div>    <div scMessageContent>      <div scMessageHeader>…</div>      <div scBubble>…</div>      <div scMessageFooter>…</div>    </div>  </div></div>

Accessibility

  • A message is layout: what it says is read from what you put in it.
  • Its actions are usually icon-only: name each, in sr-only text. A button whose effect shows (Copy) says it in its name (Copied); a toggle (Good response) keeps its name and says aria-pressed.
  • A message in progress: a Marker with role="status", so it is announced as it appears.

Examples

Avatar

OM
The build failed during dependency installation.
ME
Can you share the exact error?
OM
Here's the error from the logs
Something went wrong with the build. The libraries are not installed correctly.
import { Component, ViewEncapsulation } from '@angular/core';import {  ScAvatar,  ScAvatarFallback,  ScBubble,  ScBubbleContent,  ScBubbleGroup,  ScMessage,  ScMessageAvatar,  ScMessageContent,

Group

I pushed a fix for the install step.
It pins the workspace package to the lockfile version.
OM
Can you run the build again?
ME
Running it now.
import { Component, ViewEncapsulation } from '@angular/core';import {  ScAvatar,  ScAvatarFallback,  ScBubble,  ScBubbleContent,  ScMessage,  ScMessageAvatar,  ScMessageContent,  ScMessageGroup,

Header and footer

Olivia
I already checked the logs.
Send the report to the team. Ping Sam if you need help.
Read Yesterday
import { Component, ViewEncapsulation } from '@angular/core';import {  ScBubble,  ScBubbleContent,  ScMessage,  ScMessageContent,  ScMessageFooter,  ScMessageHeader,} from '@semantic-components/ui';

Actions

The install failure is coming from the workspace package.
Okay, drop me a link. Taking a look...
Failed to send
import { Component, ViewEncapsulation } from '@angular/core';import {  ScBubble,  ScBubbleContent,  ScButton,  ScMessage,  ScMessageContent,  ScMessageFooter,} from '@semantic-components/ui';import {

Attachment

Café
Here's the image. Can you add it to the PDF, as the cover?
Done. Here's the PDF with the image as its cover.
sales-dashboard.pdf
PDF · 2.4 MB
Thanks. Looks good.
import { NgOptimizedImage } from '@angular/common';import { Component, ViewEncapsulation } from '@angular/core';import {  ScAttachment,  ScAttachmentAction,  ScAttachmentActions,  ScAttachmentContent,  ScAttachmentDescription,  ScAttachmentMedia,  ScAttachmentTitle,

Status

Why did the deploy fail?
Checking the logs...
import { Component, ViewEncapsulation } from '@angular/core';import {  ScBubble,  ScBubbleContent,  ScMarker,  ScMarkerContent,  ScMarkerIcon,  ScMessage,  ScMessageContent,  ScSpinner,

Pattern

How do I add a settings dialog? It should open from the gear icon in the header.
Add a dialog with its trigger on the gear button in the header, and put the settings form inside it.
import {  Component,  DestroyRef,  ViewEncapsulation,  inject,  signal,} from '@angular/core';import {  ScBubble,  ScBubbleContent,

RTL

ل
ليلى
فشل البناء أثناء تثبيت الحزم.
أ
هل يمكنك مشاركة الخطأ؟
قُرئت 10:42
import { Dir } from '@angular/cdk/bidi';import { Component, LOCALE_ID, ViewEncapsulation } from '@angular/core';import {  ScAvatar,  ScAvatarFallback,  ScBubble,  ScBubbleContent,  ScMessage,  ScMessageAvatar,  ScMessageContent,

API reference

Each part takes class, merged over the style (cn: a later class wins).

PartSelectorDescription
ScMessageGroupdiv[scMessageGroup] Consecutive messages from one sender.
ScMessagediv[scMessage] align ('start', 'end' — yours: the row reversed, its bubbles and footer at the end).
ScMessageAvatardiv[scMessageAvatar] Your avatar, at the bottom, clear of the footer; empty, it keeps a group in line.
ScMessageContentdiv[scMessageContent] The column: header, bubbles, attachments, footer.
ScMessageHeader, ScMessageFooterdiv[…] The sender above; a status or actions below — at the end on your messages.