Nachricht (Chat)
Chat-Nachricht: Nutzer als Blase rechts, Assistent als Fließtext links mit Avatar; optionale Anhänge, Aktions-Leiste (Kopieren, Bewerten, Neu erzeugen) und Zeitstempel. 1.1.0: opt-in format=markdown über component.markdown-viewer. 1.8.0: opt-in skeleton = Lade-Platzhalter im Aufbau der Rolle (skelet
Nutzt: ui.icon ui.avatar ui.skeleton component.markdown-viewer
Beispiele
Eigenschaften
| Prop | Typ | Default | Builder-Label |
|---|---|---|---|
| avatarFallback | boolean | false | — |
| role | string: user | assistant | system | "assistant" | Rolle |
| skeleton | boolean | false | Lade-Platzhalter |
| skeletonLines | number | 0 | Platzhalter-Zeilen |
| layout | string: default | chat | "default" | Layout |
| grouped | boolean | false | Folgenachricht |
| actionsReveal | string: always | hover | "always" | Aktionen zeigen |
| text * | string | — | Text |
| side | string: | start | end | "" | Seite |
| bubble | boolean | false | Als Blase |
| translation | string | "" | Uebersetzung |
| translationShown | boolean | true | Uebersetzung zeigen |
| audio | boolean | false | Tonknopf |
| audioLabel | string | "" | Name des Tonknopfs |
| appear | boolean | false | Einblenden |
| format | string: text | markdown | "text" | Format |
| author | string | "" | Name (Assistent/System) |
| avatarUrl | string | "" | Avatar-Bild |
| avatarName | string | "" | Avatar-Name (Initialen) |
| time | string | "" | Zeitstempel |
| attachments | array | [] | Anhänge |
| attachmentTrigger | string | "" | — |
| embeds | array | [] | — |
| replyText | string | "" | Antwort auf (Text) |
| replyAuthor | string | "" | Antwort auf (Name) |
| replyId | number | 0 | — |
| status | string: | sent | read | failed | "" | Status |
| actionSet | string: assistant | chat | chat-resend | copy | copy-rate | "assistant" | Aktionen |
| actions | boolean | false | Aktions-Leiste zeigen |
| emojiLarge | boolean | false | Nur-Emoji gross zeigen |
| streaming | boolean | false | Schreibt gerade (Cursor) |
| markdownStream | boolean | false | Markdown wächst (Streaming) |
| padding | string: standard | none | sm | md | lg | xl | "standard" | Innenabstand (standard = Baustein-Wert) |
| margin | string: standard | none | sm | md | lg | xl | "standard" | Aussenabstand |
| border | string: standard | none | hairline | strong | "standard" | Rahmen |
| radius | string: standard | none | control | surface | pill | "standard" | Ecken-Rundung |
| textColor | string | "" | Textfarbe (Token; leer = Standard) |
| backgroundColor | string | "" | Hintergrundfarbe (Token; leer = Standard) |
| shadow | string: standard | none | sm | md | lg | "standard" | Schatten |
| width | string: standard | full | "standard" | Breite |
| alignSelf | string: standard | start | center | end | "standard" | Ausrichtung im Elternteil |
| anchor | string | "" | Anker-ID (Sprungziel, z. B. fuer Nav-Links) |
* Pflicht-Prop
Events & Slots
Events:
⚡ action⚡ audio — im Surface per on: {<event>: {action, params}} verdrahtbar.
Slot content:
akzeptiert component.gap-text, component.*, ui.*, layout.*
Slot default:
akzeptiert component.*, ui.*
Slot before:
akzeptiert component.*, ui.*
Stellschrauben (Komponenten-Tokens)
Ebene 3 — aus dem CSS generiert (Registry). Umverdrahtbar per Hüllen-Komposition, ohne Markup-Eingriff; künftige Regler-Quelle des Component Builders.
| Token | Default |
|---|---|
--message-action-primary | var(--color-action-primary) |
--message-border-default | var(--color-border-default) |
--message-radius-control | var(--shape-control) |
--message-radius-full | var(--shape-pill) |
--message-radius-sm | var(--shape-small) |
--message-radius-surface | var(--shape-card) |
--message-status-info | var(--color-status-info) |
--message-status-success | var(--color-status-success) |
--message-surface-default | var(--color-surface-default) |
--message-surface-sunken | var(--color-surface-sunken) |
--message-text-default | var(--color-text-default) |
--message-text-muted | var(--color-text-muted) |
Genutzte Design-Tokens
LLM-Notizen
component.message
Eine Chat-Nachricht. role steuert das Layout: user = Blase rechts, assistant = Fließtext links mit Avatar, system = schmaler Hinweis-Streifen.
Wann nutzen
- Immer INNERHALB von
component.conversation(die kümmert sich um Scrollen und Sticky-Bottom). - Zusatz-Bausteine (reasoning, tool, plan, sources, task) kommen in den default-Slot der Nachricht — sie gehören inhaltlich zur Antwort.
- Soll der Denkprozess bzw. das Werkzeug VOR der Antwort stehen (wie im alten wingQ), gehört er in den before-Slot (1.13.0, opt-in): er steht im Body vor Anhängen und Text; leer = kein Block, Markup wie ohne Slot.
Wichtige Props
text* (nl2br-gerendert, immer escaped),author,time,avatarUrlattachments=[{name, meta?}]actions: blendet die Aktions-Leiste ein;actionSetwählt sie:assistant= Kopieren/Neu erzeugen/Daumen (Standard),chat= Kopieren/Antworten,chat-resend= dazu Erneut senden,copy= nur Kopieren,copy-rate(1.13.0) = Kopieren + Daumen hoch/runter ohne Neu erzeugen (wingQ-Antworten)streaming: blinkender Cursor am Textende („schreibt gerade“)emojiLarge(1.13.0, opt-in, Standard false): besteht der Text nur aus 1–3 Emoji (auch Hautfarbe, Flaggenpaar, Tastenkappe, ZWJ-Folge wie Familie), bekommt der Textblock die Klasseinvisible-message__text--emoji– groß und ohne Blase. Text dazwischen, Ziffern, Leerzeichen zwischen den Emoji oder mehr als drei Emoji = normal.- Gespräch zweier Personen (1.15.0, alles opt-in):
side=start|end(Seite unabhängig von der Rolle),bubble(Blase auch für fremde Nachrichten),translation+translationShown(Zeile unter dem Text, ein/aus),audio(Tonknopf neben der Blase,audioLabel). - Slot content (1.15.0): eigener Inhalt in der Blase anstelle des Textes, z. B.
component.gap-text;textdarf dann leer sein (text: ''). appear(1.16.0, opt-in): neue Nachricht blendet kurz von unten ein; aus mitprefers-reduced-motionbzw.[data-motion="reduce"]. Nur für neu erscheinende Zeilen setzen, nicht für einen ganzen geladenen Verlauf.
Beispiel-Node
{
"definition": "component.message",
"props": {"role": "assistant", "author": "NEX-Assistent", "text": "Zwei Aufträge sind überfällig.", "actions": true, "actionSet": "copy-rate"},
"slots": {
"before": [{"definition": "component.reasoning", "props": {"text": "Ich prüfe die offenen Aufträge …"}}],
"default": [{"definition": "component.tool", "props": {"name": "snappy_cli__task_list", "state": "done"}}]
}
}
Hinweise
- Emittiert
actionmit{action: copy|retry|up|down|reply}— Kopieren funktioniert eigenständig. - Slots in Svelte:
slots={{ before: snippet, default: snippet }}(Snippet oder fertiges HTML); beide Slots sind opt-in, ohne sie bleibt das Markup unverändert. - Tonknopf (1.15.0): emittiert
audio({}); die Seite spielt den Ton der Zeile. - Sprechblase mit Lücke (Svelte):
<Invisible id="component.message" props={{ text: '', role: 'assistant', layout: 'chat', author: 'Mia', avatarName: 'Mia', side: 'end', bubble: true, translation: 'Es ist ein Hund.', translationShown, audio: geloest }} slots={{ content: luecke }} onAudio={() => sprecher.sprich(satz)} />mit{#snippet luecke()}<Invisible id="component.gap-text" props={{ text: 'It is a ___.', lang: 'en', gaps: [{ value: wert, state: zustand }] }} onInput={…} onSubmit={…} />{/snippet}. - Es gibt weiter nur die Renderer php-html und svelte (kein go-html), wie vor 1.15.