Proof Forge
Proof strip of short claims, each with an SVG tick that draws in sequence once when the strip scrolls into view. Token-only, follows the site theme, and reduced motion draws the ticks at once.
pnpm dlx shadcn@latest add @leo/proof-forgeProps
| Name | Type | Default | Description |
|---|---|---|---|
| className | string | undefined | - | |
| items | string[] | undefined | ["No template themes", "Full source code handover", "Reply within 24 hours"] | Omit for the sample claims; an empty array renders nothing. |
| label | string | undefined | Our commitments | Accessible name of the list. |
| reducedMotion | undefined | "respect" | "ignore" | respect | "ignore" keeps the tick animation for visitors who prefer reduced motion. |
Dependencies
- motion@^12.23.12
Source
"use client";
import { useInView } from "motion/react";
import { useRef } from "react";
import { useForgeMotion } from "@/hooks/use-forge-motion";
import { cn } from "@/lib/utils";
export interface ProofForgeProps {
/** Omit for the sample claims; an empty array renders nothing. */
items?: string[];
/** Accessible name of the list. */
label?: string;
/** "ignore" keeps the tick animation for visitors who prefer reduced motion. */
reducedMotion?: "respect" | "ignore";
className?: string;
}
const DEFAULT_ITEMS = ["No template themes", "Full source code handover", "Reply within 24 hours"];
export default function ProofForge({
items = DEFAULT_ITEMS,
label = "Our commitments",
reducedMotion = "respect",
className,
}: ProofForgeProps) {
const listRef = useRef<HTMLUListElement>(null);
const inView = useInView(listRef, { once: true, amount: 0.6 });
const { hydrated, animate } = useForgeMotion(reducedMotion);
if (items.length === 0) return null;
// Server markup and the pre-hydration frame stay undrawn so the draw-in is never skipped by hydration.
const drawn = hydrated && (!animate || inView);
return (
<section className={cn("border-y border-border bg-background text-foreground", className)}>
<ul
ref={listRef}
aria-label={label}
className="grid divide-y divide-border md:grid-flow-col md:auto-cols-fr md:divide-x md:divide-y-0"
>
{items.map((item, i) => (
// biome-ignore lint/suspicious/noArrayIndexKey: claims may repeat and the list is static, so the index is the only stable key
<li key={`${item}-${i}`} className="flex items-center gap-3 px-6 py-5">
<svg
aria-hidden="true"
viewBox="0 0 24 24"
fill="none"
className="size-5 shrink-0 text-primary"
>
<path
d="M4 12.5l5 5L20 6.5"
pathLength="1"
stroke="currentColor"
strokeWidth="2"
strokeLinecap="round"
strokeLinejoin="round"
strokeDasharray="1"
style={{
strokeDashoffset: drawn ? 0 : 1,
...(animate
? {
transition: "stroke-dashoffset 400ms ease-out",
transitionDelay: `${i * 150}ms`,
}
: null),
}}
/>
</svg>
<span className="text-sm md:text-base">{item}</span>
</li>
))}
</ul>
</section>
);
}