ngx-prompt-kit

Message

A row in a chat thread. Pairs an avatar with content; supports plain text or markdown, plus a row of inline actions.

Examples

Basic conversation

A back-and-forth exchange. User messages align right, assistant messages align left with an avatar.

Could you summarize the latest commit log into release notes? AI I can help with that — pull the commit range and I'll group them into features, fixes, and chores.

With markdown

Set [markdown]=true on the content to render headings, lists, code, and emphasis.

Give me the v0.1.0 changelog as markdown. AI

v0.1.0

  • Refactored the auth middleware
  • Added session.refresh() helper
  • Fixed an off-by-one in pagination

Want me to group by author next time?

With actions

MessageActions and MessageAction add interactive controls below an assistant message — copy, regenerate, thumbs up/down.

Explain the difference between signal() and computed().
AI signal() holds writable state. computed() derives a read-only value from one or more signals; it re-evaluates lazily when its dependencies change.

Installation

Add the message component (and the cn() utility) to your project.

ng generate ngx-prompt-kit:message

Component API

PkMessage

PropTypeDefaultDescription
classstringExtra classes merged onto the host.

PkMessageAvatar

PropTypeDefaultDescription
srcstringAvatar image URL (required).
altstringAlt text for the image (required).
fallbackstringInitials shown if the image fails.
classstringExtra classes for the avatar.

PkMessageContent

PropTypeDefaultDescription
contentstringThe text content. Optional — you can also project markup via ng-content.
markdownboolean false Render content as markdown via pk-markdown.
classstringExtra classes for the bubble.

PkMessageActions

PropTypeDefaultDescription
classstringExtra classes for the action row.

PkMessageAction

PropTypeDefaultDescription
tooltipstringTooltip label shown on hover (required).
side"top" | "bottom" | "left" | "right" "top" Tooltip placement.
classstringExtra classes applied to the tooltip content.