Conversation
Wraps messages and automatically scrolls to the bottom. Also includes a scroll button that appears when not at the bottom.
The Conversation component wraps messages and automatically scrolls to the bottom. Also includes a scroll button that appears when not at the bottom.
Install using CLI
Install Manually
Copy and paste the following code in the same folder.
Usage with AI SDK
Build a simple conversational UI with Conversation and PromptInput:
Add the following component to your frontend:
pages/index.vue
Add the following route to your backend:
server/api/chat/route.ts
Features
- Automatic scrolling to the bottom when new messages are added
- Smooth scrolling behavior with configurable animation
- Scroll button that appears when not at the bottom
- Responsive design with customizable padding and spacing
- Flexible content layout with consistent message spacing
- Accessible with proper ARIA roles for screen readers
- Customizable styling through class prop
- Support for any number of child message components
Props
<Conversation />
ariaLabelstring
'Conversation'classstring
initialboolean | 'instant' | { damping?: number; stiffness?: number; mass?: number }
trueresize'instant' | { damping?: number; stiffness?: number; mass?: number }
dampingnumber
0.7stiffnessnumber
0.05massnumber
1.25anchor'auto' | 'none'
'none'<ConversationContent />
classstring
<ConversationEmptyState />
titlestring
'No messages yet'descriptionstring
'Start a conversation to see messages here'classstring
<ConversationScrollButton />
classstring