Skip to main content

Checkpoint

A horizontal conversation restore divider pairing scale-drawn Separator rules and a Kinetic Button trigger that swaps into Restored.

@heroicons/react
Turn 1 · Assistant

Synced spring token presets and cleaned up duplicate Customize controls.

14:22
Turn 2 · Subsequent draft

Applied experimental grid padding override and renamed footer actions.

Customize

Speed0.45
Blur reveal (px)8

Installation

npx shadcn@latest add @kinetic/checkpoint

Usage

Combine Checkpoint and CheckpointTrigger between conversation turns to mark a restorable snapshot (with an optional CheckpointIcon slot when needed).

"use client";

import { useState } from "react";
import {
  Checkpoint,
  CheckpointTrigger,
} from "@/components/kinetic/ui/checkpoint";

export function TurnCheckpoint() {
  const [restored, setRestored] = useState(false);

  return (
    <Checkpoint timestamp="10:42 AM" restored={restored}>
      <CheckpointTrigger restored={restored} onRestoredChange={setRestored}>
        Restore checkpoint
      </CheckpointTrigger>
    </Checkpoint>
  );
}

Restore trigger and divider lines

Two flanking Separator rules draw outward from the center content via scaleDraw, while CheckpointTrigger supports controlled or uncontrolled restored state and switches smoothly into restoredLabel using directionalSwap and a drawStroke checkmark.

import {
  Checkpoint,
  CheckpointTrigger,
} from "@/components/kinetic/ui/checkpoint";

interface TurnDividerProps {
  readonly timestamp: string;
  readonly restored: boolean;
  readonly onRestore: () => void;
}

export function TurnDivider({ timestamp, restored, onRestore }: TurnDividerProps) {
  return (
    <Checkpoint timestamp={timestamp} restored={restored} drawOnView={false}>
      <CheckpointTrigger
        variant="secondary"
        restored={restored}
        confirmOnClick={false}
        onClick={onRestore}
      >
        Roll back here
      </CheckpointTrigger>
    </Checkpoint>
  );
}

Motion preferences

Checkpoint uses speed={0.45} and blurPx={8} by default for rule scaleDraw, content directionalSwap, and checkmark drawStroke. Reduced motion displays rules, labels, and checkmarks immediately without blur or draw delays.

API Reference

Checkpoint

Conversation divider combining two scale-drawn Separator rules, directional content enter, and synchronized restored state.

PropTypeDefaultDescription
timestamp / restored / lineClassNameReact.ReactNode / boolean / stringundefined / false / undefinedTurn timestamp, controlled restored styling across CheckpointIcon/CheckpointTrigger, and custom line class.
drawOnView / once / playboolean / boolean / booleantrue / true / undefinedTriggers flanking Separator scaleDraw on viewport intersection or explicit play flag.
animated / speed / blurPxboolean / number / numbertrue / 0.45 / 8Enables animations, scales timing across lines and trigger swaps, and sets blur radius (px).

CheckpointIcon

Bookmark or flag icon indicator that transitions to emerald highlight when restored.

PropTypeDefaultDescription
variant"bookmark" | "flag""bookmark"Chooses default bookmark or flag outline icon.

CheckpointTrigger

Kinetic Button trigger swapping cleanly via directionalSwap and drawing a checkmark via drawStroke when restored.

PropTypeDefaultDescription
restored / defaultRestored / onRestoredChangeboolean / boolean / (restored: boolean) => voidfalseControlled or initial restored confirmation state.
restoredLabel / confirmOnClickReact.ReactNode / boolean"Restored" / truePost-restore label text and automatic confirmation toggle on click.
variant / sizeKineticButtonVariant / KineticButtonSize"outline" / "xs"Kinetic Button visual variant and size preset.
animated / speed / blurPxboolean / number / numberinheritedOptional overrides for swap blur, speed, and stroke draw activation.