Message
One turn: the person's message, and the agent's reply with its actions.
Usage
Message
import { NgTemplateOutlet } from '@angular/common';import { Component, DestroyRef, ViewEncapsulation, inject, signal,} from '@angular/core';import { ScBubble,The person's text is a Bubble on a Message aligned to the end; the agent's reply is text on a Message, with actions under it. A thread of these turns is Chat.
Anatomy
import { ScMessage, ScMessageContent, ScMessageFooter, ScBubble, ScBubbleContent, ScButton,} from '@semantic-components/ui';<div scMessage alignment="end"> <div scMessageContent> <div scBubble alignment="end" variant="muted"> <div scBubbleContent>How do I add a settings dialog?</div> </div> </div></div><div scMessage> <div scMessageContent class="gap-2"> <p>Install Dialog, then open it from the gear button.</p> <div scMessageFooter> <button scButton variant="ghost" size="icon-sm"> <svg siCopyIcon></svg> <span class="sr-only">Copy</span> </button> </div> </div></div>Actions
Actions go in the message's footer, which follows its alignment: on the person's turn they sit at the end. Ghost icon buttons, each named by hidden text and shown in a tooltip.
- Copy writes the reply to the clipboard and turns to a check for two seconds; its name follows: Copy, then Copied.
- Good response and Bad response are toggles: a fixed name, the state in
aria-pressed. - Retry runs the turn again.
- Edit, on the person's turn, puts the text back in the field.
Markdown
The reply streams as markdown. The library has no Markdown renderer yet: here the reply is written out, its code in a Code Block.
Examples
RTL
import { Dir } from '@angular/cdk/bidi';import { Component, LOCALE_ID, ViewEncapsulation } from '@angular/core';import { ScBubble, ScBubbleContent, ScButton, ScMessage, ScMessageContent, ScMessageFooter,} from '@semantic-components/ui';