Conversation History

The sidebar of past chats: grouped by day, searchable, rename, pin and delete in place.

PROGet Conversation History and 168 other Pro components with pro lifetime — Get Pro

Category
AI Chat
Access
Pro
Source
446 lines · one file
States
7 drawn

When to use it

Use Conversation History for the list of past chats: grouped by day, searchable, with rename, pin and delete in place. You pass the list and handle the callbacks; it never changes your data. Pair it with Sidebar for the app shell and AI Chat for the open conversation.

Installation

How you get it

Paste this into Claude Code, Cursor, Codex or any coding agent. It installs the file and uses it as it is, instead of writing a new one.

Use Liro's Conversation History for this.
Install it: npx shadcn@latest add @liro/conversation-history
(the @liro registry is set up in components.json, with LIRO_KEY in .env.local)
Import it from @/components/ui/conversation-history.
Do not rewrite or restyle it. Pass my data through its props
and keep its built-in states.

For the full brief with every prop and the mistakes assistants usually make, use Copy prompt above. Pro components install through the @liro registry with your CLI token: see the Namespaced tab.

Usage

components/chat-history.tsx
import * as React from "react";
import { ConversationHistory, type Conversation } from "@/components/ui/conversation-history";

export function ChatHistory({
  conversations,
  activeId,
  onOpen,
  onNew,
  onRename,
  onPin,
  onDelete,
}: {
  conversations: Conversation[];
  activeId?: string;
  onOpen: (id: string) => void;
  onNew: () => void;
  onRename: (id: string, title: string) => void;
  onPin: (id: string, pinned: boolean) => void;
  onDelete: (id: string) => void;
}) {
  return (
    <div className="h-[480px]">
      <ConversationHistory
        conversations={conversations}
        activeId={activeId}
        onSelect={onOpen}
        onNew={onNew}
        onRename={onRename}
        onPin={onPin}
        onDelete={onDelete}
      />
    </div>
  );
}

API reference

“Copy prompt” above puts a full brief on your clipboard, install command, dependencies, props, and the mistakes an assistant usually makes with this component.

Props

Read from the component’s own TypeScript interface when the site is built, so this table cannot drift from the file you install.

TypeNotes
conversationsConversation[] Yes–
activeIdstring No–
onSelect(id: string) => void No–
onNew() => void NoLeave it out to hide the New conversation button.
onRename(id: string, title: string) => void NoLeave any of these three out to remove it from the row's menu.
onPin(id: string, pinned: boolean) => void No–
onDelete(id: string) => void No–
searchboolean NoThe search box. Default true.
loadingboolean NoSkeleton rows while the list is fetched.
nowDate No"Today" is measured from here. Default: now.
titleReact.ReactNode NoThe heading. Default "Chats".

Dependencies

npm packages

clsxframer-motionlucide-reacttailwind-merge

Liro foundations, installed alongside it

liro-themebuttondropdown-menuinputstate

States

All of them are drawn by the component. None is left for you to design.

  • Default
  • Searching
  • No results
  • Renaming
  • Confirming delete
  • Loading
  • Empty

Accessibility

  • Keyboard reachable throughout, in visual order
  • Focus trapped in overlays, Escape closes them
  • Focus returns to whatever opened it
  • Live regions announce what changed, not that something did
  • Honours prefers-reduced-motion

Responsive behavior

  • Sizes to its container, not the viewport
  • Usable from 320px up
  • Pointer-based interaction, so trackpad and touch both work
  • No hover-only affordances

Used in a screenAll screens