Skip to content

Chat Thread

Last updated 15 Nov 2026

NbChatThread is a conversation: a scrolling log of NbChatMessages that follows the newest one unless the reader has scrolled up, and an optional composer under it. Use it where people talk to each other or to an agent.

NbChatThread ​

It fills the height it is given and scrolls inside it. Give it a height through its container: a flex column, a panel body, a grid row.

Props ​

PropTypeDefaultDescription
draftstring''The composer's text (v-model:draft)
labelstringcatalogueThe log's accessible name (chatThreadLabel, "Conversation")
workingbooleanfalseShows the working indicator after the newest message and marks the log busy
workingLabelstringcatalogueWhat the indicator says (chatThreadWorking, "Working")
composerbooleanfalseShows the composer under the log
composerLabelstringcatalogueThe field's accessible name (chatThreadMessage, "Message")
placeholderstringcatalogueThe field's placeholder (chatThreadPlaceholder, "Write a message")
disabledbooleanfalseTurns the composer off. The log stays readable
disabledReasonstring-Why: under the field and as the send button's tooltip
stoppablebooleanfalseWhile working, shows a stop button that emits stop
sendLabelstringcatalogueThe send button's name and tooltip (chatThreadSend, "Send")
stopLabelstringcatalogueThe stop button's name and tooltip (chatThreadStop, "Stop")
maxRowsnumber6Rows the field grows to before it scrolls

Events ​

EventPayloadDescription
sendtext: stringThe trimmed text. The composer empties itself after emitting
stop-The stop button was pressed
update:draftstringOn every keystroke, and when the composer empties after a send

Slots ​

SlotDescription
defaultThe messages, oldest first
emptyShown in the log while there are no messages

Exposed ​

NameTypeDescription
scrollToNewest() => voidScrolls the log to the newest message
focus() => voidMoves focus into the composer

The "Jump to newest" button is named by the catalogue's jumpToNewest, shared with NbLogView.

NbChatMessage ​

Props ​

PropTypeDefaultDescription
authorstringrequiredWho said it
picturestring | null-A URL draws the picture, null the author's initials. Left out, no avatar
ownbooleanfalseThe viewer's own message: at the end of the line, on the accent surface
textstring''The message as plain text. Line breaks are kept
timestring | number | Date-When it was said: a <time>, as a short time of day, the full date as its tooltip
timeLabelstring-A ready-made time string, used in place of the formatted time
localestringruntimeBCP 47 tag for formatting time
aibooleanfalseA model wrote it: draws the inline AI label after the author
aiExplainstring-What the AI label explains when opened

Slots ​

SlotDescription
defaultRich content in place of text
ai-explainRich content for the AI label's explanation
ai-labelReplaces the AI label whole, for one that needs revertable, plain-available or actions

Streaming a reply ​

Text streamed into the last message is followed like a new message, because the thread watches what it renders rather than a prop. Push the message once and grow its text.

ts
const reply = reactive({
  id: crypto.randomUUID(),
  author: 'Assistant',
  ai: true,
  text: '',
})
messages.value.push(reply)
for await (const chunk of stream) reply.text += chunk