AI primitive
PromptHistory
Scrollable prompt history list with star, copy and replay actions per item. Designed for chat sidebars or coding-agent panels.
Usage
Pick your edition with the tabs. Selection syncs across all docs.
tsx
import { PromptHistory } from '@/components/organisms'
<PromptHistory
items={[
{
id: 'p1',
prompt: 'Refactor the auth handler to use middleware',
modelId: 'sonnet',
timestamp: '2026-05-05T12:34:00Z',
starred: true,
},
]}
onReplay={(item) => composer.setPrompt(item.prompt)}
onStar={(item) => toggleStar(item.id)}
/>Props
Same surface in both editions; HTML version exposes equivalents through Alpine x-data.
| Prop | Type | Default | Description |
|---|---|---|---|
| items | PromptHistoryItem[] | [] | Ordered list of past prompts. |
| onReplay | (item) => void | — | Called when the user clicks the replay action. |
| onStar | (item) => void | — | Called when the user toggles the star. |
| onCopy | (item) => void | — | Optional. Defaults to clipboard.writeText. |
Accessibility
role
Each row is an <li> with named buttons (aria-label).
size
Action buttons are 24px hit-targets at minimum (h-6 w-6).
motion
Hover transitions respect prefers-reduced-motion.