AI Conversation History

AI
Settings

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

PropTypeDefaultDescription
conversationsConversation[](demo data)Array of conversation objects to display
selectedIdstring | numberCurrently selected conversation ID (controlled mode)
onSelect(conversation: Conversation) => voidCallback when a conversation is selected
onNewChat() => voidCallback when "New Chat" button is clicked
onSettings() => voidCallback when settings button is clicked
heightstring | number'500px'Height of the panel container
classNamestringAdditional CSS classes for the container

Conversation Type

PropTypeDefaultDescription
id*string | numberUnique conversation identifier
title*stringConversation title
preview*stringPreview/snippet of the conversation
time*stringRelative timestamp (e.g., "2 min ago")
pinnedbooleanWhether conversation is pinned to top
unreadbooleanWhether 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 components

This 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 elements

Keyboard Navigation

KeyAction
TabNavigate between search, buttons, and conversation items
EnterSelect 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