Conversation page sidebar — Chat block
Prochat-conversation-page-sidebar · for app pages
Conversation page sidebar
A full workspace with conversation history beside the host-provided conversation.
Documentation
Installation
One command copies the block into your project with the shadcn CLI (the registry is set once: Installation).
pnpm dlx shadcn-vue@latest add @trame/chat-conversation-page-sidebarUsage
Its demo data, shortened (Using blocks).
<script setup lang="ts">
import ChatConversationPageSidebar from '@/components/trame/blocks/chat/chat-conversation-page-sidebar.vue'
const props = {
title: "A hand with this case",
description: "Find what you need before you reply.",
messages: [
{
id: "q1",
role: "user",
body: "What’s missing before we can process this return request?",
at: "10:24 a.m."
},
{
id: "a1",
role: "assistant",
body: "The reason for the return has been provided. You still need to check the item’s condition and choose the refund method.\n\nThe procedure calls for an inspection on receipt before the case is closed.",
at: "10:24 a.m.",
sources: [
{
label: "Return procedure",
action: "open-source",
record: {
id: "returns"
}
},
{
label: "Return case",
action: "open-return",
record: {
id: "ret-24"
}
}
],
actions: [
{
label: "View the case",
action: "open-return",
record: {
id: "ret-24"
}
}
]
}
],
prompts: [
"Draft a reply to the customer",
"Which documents should I check?"
],
history: [
{
id: "h1",
title: "Return to check",
at: "Today",
action: "conversation",
current: true
},
{
id: "h2",
title: "Shipping terms",
at: "Yesterday",
action: "conversation"
}
],
action: "ask-assistant",
options: {
footnote: "Check the sources before making a decision."
}
}
</script>
<template>
<ChatConversationPageSidebar v-bind="props" />
</template>Props
Each prop says who changes it: Words, Picture, Action, Design, Data.* required.
| Prop | Type | Description |
|---|---|---|
| title* | string | Wordsthe section’s heading |
| description | string | Wordsa few words saying more, under the heading |
| messages* | Message[] | Datathe conversation, oldest first |
| prompts | string[] | Wordssuggested questions to start with |
| history* | History[] | Datapast conversations, each a link |
| action | string | ActionPOST destination; receives body |
| options | Options | the block’s settings: layout choices and secondary words, read by every variant |
Message messages[] · 7 props
| Prop | Type | Description |
|---|---|---|
| id* | string | number | Datathe history entry’s id |
| role* | 'user' | 'assistant' | who speaks: the user or the assistant |
| author | Author | who wrote it |
| body* | string | Wordsthe message itself |
| at | string | Wordswhen it was sent, as the host writes it |
| sources | Source[] | the sources the answer cites |
| actions | Action[] | links the answer offers |
Author messages[].author · 6 props
| Prop | Type | Description |
|---|---|---|
| id | string | number | Datathe record’s id in the tool that answers it |
| name* | string | Wordsthe person’s name |
| role | string | Wordstheir role or job title |
| company | string | Wordswhere they work |
| avatar | string | Picturea picture: a root-relative path (/media/…) or an absolute URL |
| url | string | Designa page about them |
Source messages[].sources[] · 3 props
| Prop | Type | Description |
|---|---|---|
| label* | string | Wordsthe words on the button or link |
| action* | string | Actiona named action of the page |
| record | Record<string, unknown> | Datathe record the action applies to, passed to the host with it, if any |
Action messages[].actions[] · 3 props
| Prop | Type | Description |
|---|---|---|
| label* | string | Wordsthe words on the button or link |
| action* | string | Actiona named action of the page |
| record | Record<string, unknown> | Datathe record the action applies to, passed to the host with it, if any |
History history[] · 5 props
| Prop | Type | Description |
|---|---|---|
| id* | string | number | Datathe history entry’s id |
| title* | string | Wordsthe history entry’s title |
| at | string | Wordswhen it took place, as the host writes it |
| action* | string | Actiona named action of the page |
| current | boolean | true: the conversation shown now |
Options options · 2 props
| Prop | Type | Description |
|---|---|---|
| footnote | string | Wordsa small line at the foot of the section |
| mood | 'inverse' | 'brand' | 'warm' | 'tint' | string | a band of the page that redefines the theme surfaces inside it |
What it asks your app for
The block never knows your app: it asks it, through one context provided once, where its links lead, what its actions do, how a price reads and which words to say (The host context).
| Member | What it is for |
|---|---|
| href | the address an action leads to, or null to hide what leads there |
| act | runs a change (subscribe, add to cart, save) and answers { ok } or { ok: false, error } |
| can | whether the page has this action |
| Link | your router’s link component |
| cartCount | the cart badge’s number |
| cartDrawer | whether your app has a cart drawer |
| cartOpen | whether the cart drawer is open |
| label | your word for an interface key, or undefined to keep the block’s own |
The words it says itself, in English and French; label(key) replaces any of them:
| Key | English | French |
|---|---|---|
| newsletter.already | You are already subscribed. | Vous êtes déjà inscrit. |
| newsletter.done | Done: you are subscribed. | C’est noté : vous êtes inscrit. |
| newsletter.invalid | Check the email address. | Vérifiez l’adresse e-mail. |
| newsletter.tooMany | Too many attempts, try again in a moment. | Trop de tentatives, réessayez dans un moment. |
Features
- Every word in the server HTML
- Same markup in Vue and React
- Theme tokens only: every theme, light and dark
- Shows what you give it, invents nothing
- No motion; still under reduced motion
- Real buttons and links, a visible focus
- Asks your app through actions:
messages[].sources[],messages[].actions[],history[],action - Reads
messages,conversationsfrom your app
A chat section, for app pages; it uses @lucide/vue, @vueuse/core, class-variance-authority, clsx, tailwind-merge.
Built with
The components this block is made of; each one installs on its own too.
More chat blocks
- Assistant inline: A single answer card inside a record page, with earlier context kept in an open disclosure.
- Assistant panel: A narrow companion panel with sourced answers and follow-up prompts supplied by the host.
- Conversation bubbles: a customer conversation on a ticket or an order: two sides, the team dark, notes tinted, reply and note tabs.
- Inbox three pane: triage support tickets or messages on a wide screen: the list, the thread and its properties side by side.
- Inbox two pane: email-like reading: the list beside the thread, the correspondent’s details in the thread header.
- Message digest sections: an app-home widget: threads grouped in labelled sections with their unread counts, no reading pane.
- Support widget: a support entry point on a page: an invitation, the people who answer, chat and knowledge-base buttons.
- Thread correspondence: A spacious message ledger beside a separate writing desk for sustained replies to the merchant’s own conversation.