AI Conversation History
Sidebar panel displaying searchable conversation history with pinned and recent sections. Includes new chat button, settings access, and selection state management.
Preview
Interactive conversation history panel
History
Pinned
React hooks explained
Can you help me understand...
2 min ago
Recent
API design best practices
What are the best practices...
1 hour ago
Database optimization
How can I optimize my...
Yesterday
Marketing strategy
Help me create a plan...
2 days ago
Custom Height
Adjust panel height for different layouts
History
Pinned
React hooks explained
Can you help me understand...
2 min ago
Recent
API design best practices
What are the best practices...
1 hour ago
Database optimization
How can I optimize my...
Yesterday
Marketing strategy
Help me create a plan...
2 days ago
Custom Conversations
Provide your own conversation data
History
Pinned
Design System Architecture
Help me plan the component structure...
5 min ago
TypeScript Generics
Can you explain advanced generics...
30 min ago
Recent
API Rate Limiting
What are the best practices for...
2 hours ago
Props
AIConversationHistory component API reference
| Prop | Type | Default | Description |
|---|---|---|---|
conversations | Conversation[] | (demo data) | Array of conversation objects to display |
selectedId | string | number | — | Currently selected conversation ID (controlled mode) |
onSelect | (conversation: Conversation) => void | — | Callback when a conversation is selected |
onNewChat | () => void | — | Callback when "New Chat" button is clicked |
onSettings | () => void | — | Callback when settings button is clicked |
height | string | number | '500px' | Height of the panel container |
className | string | — | Additional CSS classes for the container |
Conversation Type
| Prop | Type | Default | Description |
|---|---|---|---|
id* | string | number | — | Unique conversation identifier |
title* | string | — | Conversation title |
preview* | string | — | Preview/snippet of the conversation |
time* | string | — | Relative timestamp (e.g., "2 min ago") |
pinned | boolean | — | Whether conversation is pinned to top |
unread | boolean | — | Whether conversation has unread messages |
Usage
Import and implementation example
import { AIConversationHistory } from '@/blocks/ai-conversation/ai-conversation-history'
export default function Example() {
const conversations = [
{
id: '1',
title: 'React hooks explained',
preview: 'Can you help me understand...',
time: '2 min ago',
pinned: true,
unread: false,
},
{
id: '2',
title: 'API design best practices',
preview: 'What are the best practices...',
time: '1 hour ago',
pinned: false,
unread: true,
},
]
return (
<AIConversationHistory
conversations={conversations}
selectedId="1"
onSelect={(conv) => console.log('Selected:', conv)}
onNewChat={() => console.log('New chat')}
onSettings={() => console.log('Settings')}
height="600px"
/>
)
}Built With
2 componentsThis block uses the following UI components from the design system:
Features
Built-in functionality
- Search functionality: Real-time filtering of conversations by title
- Pinned section: Separate section for pinned conversations at the top
- Unread indicators: Blue dot badges for unread conversations
- New chat button: Sparkles icon button to start new conversations
- Relative timestamps: Human-readable time indicators (e.g., "2 min ago")
- Selected state: Clear visual highlighting with indigo accent border
- Scrollable list: Overflow handling for long conversation lists
- Settings access: Settings gear icon in the header
- Dark mode: Full dark mode support with proper contrast
Accessibility
Accessibility considerations
ARIA Attributes
Conversation items are clickable divs with cursor pointerSearch input has placeholder text for guidanceButtons (New Chat, Settings) are native button elementsKeyboard Navigation
| Key | Action |
|---|---|
| Tab | Navigate between search, buttons, and conversation items |
| Enter | Select focused conversation or activate button |
Notes
- Pin and unread indicators are visual-only - consider adding aria-label
- Selected state uses both color and border for visibility
- Long titles and previews are truncated with ellipsis
- Consider adding aria-selected to conversation items for screen readers
- Search filters in real-time without requiring form submission