# Geist Checkpoint

A point in the conversation you can go back to.

Build a Checkpoint in this project that looks and behaves like Geist's. Measured from the running Geist app (vercel.com/geist). Keep every value exact. Map the tokens onto the project's own theme variables instead of hard-coding them. Use the project's own component library for behaviour, or Base UI primitives if it has none.

Fidelity: Partly measured from the AI Elements Checkpoint. Colours are mapped to Geist's gray scale.

## Tokens

| Token | Light | Dark |
| --- | --- | --- |
| `--ds-gray-700` | `hsl(0 0% 56%)` | `hsl(0 0% 56%)` |
| `--ds-gray-900` | `hsl(0 0% 30%)` | `hsl(0 0% 63%)` |
| `--ds-gray-1000` | `hsl(0 0% 9%)` | `hsl(0 0% 93%)` |
| `--ds-gray-alpha-200` | `#00000014` | `#ffffff17` |
| `--ds-gray-alpha-400` | `#00000014` | `#ffffff24` |
| `--ds-focus-ring` | `0 0 0 2px var(--ds-background-100), 0 0 0 4px var(--ds-focus-color)` | `0 0 0 2px var(--ds-background-100), 0 0 0 4px var(--ds-focus-color)` |
| `--ease-in-out` | `cubic-bezier(0.4, 0, 0.2, 1)` | `cubic-bezier(0.4, 0, 0.2, 1)` |
| `--default-transition-duration` | `0.15s` | `0.15s` |
| `--font-size-small` | `0.875rem` | `0.875rem` |
| `--font-weight-medium` | `500` | `500` |
| `--radius-control` | `6px` | `6px` |

## CSS

Scoped under `[data-style="geist"]`; dark rules sit under `[data-theme="dark"]`. The `ui-*` classes and data attributes match the structure below.

```css
[data-style="geist"] {
  .ui-checkpoint {
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 0;
    color: var(--ds-gray-900);
    font-family: inherit;
    font-size: var(--font-size-small);
    line-height: 20px;

    &::after {
      content: "";
      flex: 1;
      min-width: 16px;
      height: 1px;
      margin-left: 8px;
      background-color: var(--ds-gray-alpha-400);
    }
  }

  .ui-checkpoint-icon {
    display: flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;

    & svg {
      width: 16px;
      height: 16px;
    }
  }

  .ui-checkpoint-label {
    flex-shrink: 0;
    padding-left: 4px;
    white-space: nowrap;
  }

  .ui-checkpoint-trigger {
    box-sizing: border-box;
    display: inline-flex;
    flex-shrink: 0;
    align-items: center;
    gap: 6px;
    height: 32px;
    margin: 0;
    padding: 0 8px;
    border: none;
    border-radius: var(--radius-control);
    background-color: transparent;
    color: var(--ds-gray-900);
    font: inherit;
    font-weight: var(--font-weight-medium);
    white-space: nowrap;
    cursor: pointer;
    transition:
      background-color var(--default-transition-duration) var(--ease-in-out),
      color var(--default-transition-duration) var(--ease-in-out);

    & svg {
      width: 16px;
      height: 16px;
    }

    &:focus-visible {
      outline: none;
      box-shadow: var(--ds-focus-ring);
    }

    @media (hover: hover) {
      &:hover:not([data-disabled]) {
        background-color: var(--ds-gray-alpha-200);
        color: var(--ds-gray-1000);
      }
    }

    &[data-disabled] {
      color: var(--ds-gray-700);
      cursor: not-allowed;
    }
  }

  @media (prefers-reduced-motion: reduce) {
    .ui-checkpoint-trigger {
      transition: none;
    }
  }
}
```

## Structure

How Replicas assembles it on Base UI.

```tsx
import { Button as BaseButton } from "@base-ui/react/button";
import type { ComponentProps } from "react";
import { join } from "./utils";

function Root({ className, ...props }: ComponentProps<"div">) {
  return <div className={join("ui-checkpoint", className)} {...props} />;
}

function Icon({ className, children, ...props }: ComponentProps<"span">) {
  return (
    <span className={join("ui-checkpoint-icon", className)} aria-hidden {...props}>
      {children ?? (
        <svg viewBox="0 0 16 16" fill="none">
          <path d="M4.5 2.5h7v11L8 11l-3.5 2.5z" stroke="currentColor" strokeWidth="1.5" strokeLinejoin="round" />
        </svg>
      )}
    </span>
  );
}

function Label({ className, ...props }: ComponentProps<"span">) {
  return <span className={join("ui-checkpoint-label", className)} {...props} />;
}

function Trigger({ className, ...props }: Omit<BaseButton.Props, "className"> & { className?: string }) {
  return <BaseButton className={join("ui-checkpoint-trigger", className)} {...props} />;
}

export const Checkpoint = {
  Root,
  Icon,
  Label,
  Trigger,
};
```

## Example

```tsx
import { Checkpoint } from "@replicas/ui";

export default function CheckpointDemo() {
  return (
    <Checkpoint.Root style={{ width: "100%", maxWidth: 420 }}>
      <Checkpoint.Icon />
      <Checkpoint.Label>Checkpoint</Checkpoint.Label>
      <Checkpoint.Trigger>Restore</Checkpoint.Trigger>
    </Checkpoint.Root>
  );
}
```

## Foundations

The rest of the Geist style, as a skill: https://replicas.raphaelsalaja.com/skills/geist/SKILL.md