Checkpoint

A simple component for marking conversation history points and restoring the chat to a previous state.

What is React?
React is a JavaScript library for building user interfaces. It was developed by Facebook and is now maintained by Meta and a community of developers.
How does component state work?

Installation

pnpm dlx shadcn-svelte@latest add https://svelte-ai-elements.vercel.app/r/checkpoint.json

If you prefer using jsrepo, please install via the command below:

pnpm dlx jsrepo add @ai/elements/ai-elements/checkpoint

Usage

Examples

With Tooltip

With Conversation

Custom Icon

Component API

Checkpoint

PropTypeDefaultDescription
classstring-Additional CSS classes to apply to the container
childrenSnippet-Child components (CheckpointIcon, CheckpointTrigger)
...restPropsHTMLAttributes<HTMLDivElement>-All other div props are supported

CheckpointIcon

PropTypeDefaultDescription
classstring-Additional CSS classes to apply to the icon
childrenSnippet-Custom icon content (overrides default icon)
sizenumber16Size of the icon in pixels

CheckpointTrigger

PropTypeDefaultDescription
classstring-Additional CSS classes to apply to the button
childrenSnippet-Button content
variant'default' | 'destructive' | 'outline' | 'secondary' | 'ghost' | 'link''ghost'Button variant style
size'default' | 'sm' | 'lg' | 'icon''sm'Button size
tooltipstring-Optional tooltip text to display on hover
onclick(e: MouseEvent) => void-Click handler function
disabledbooleanfalseWhether the button is disabled

Features

  • Simple flex layout with icon, trigger, and separator
  • Visual separator line for clear conversation breaks
  • Clickable restore button for reverting to checkpoint
  • Customizable icon (defaults to BookmarkIcon)
  • Optional tooltip for additional context
  • Keyboard accessible with proper ARIA labels
  • Responsive design that adapts to different screen sizes
  • Seamless light/dark theme integration

Use Cases

  • Conversation branching and exploration
  • Undo functionality for chat history
  • Version control for conversations
  • Debugging conversation flows
  • Enhanced user control over chat history