Success Check

Craft

Animated done mark for the moment something succeeds — used by ActionButton and success toasts.

Motion: Ring draws round, then the check strokes in while the mark settles from a slight turn on a bouncy spring.

Payment received

Installation

npx shadcn@latest add @craft/success-check

Source

components/ui/success-check.tsx
"use client"

import { motion } from "motion/react"
import { cn } from "cn"

import { ease, spring } from "@/lib/motion"

/**
 * Animated "done" mark: the ring draws round, then the check strokes in while
 * the whole mark settles from a slight turn on a bouncy spring. Plays once
 * when it mounts — render it at the moment something succeeds (ActionButton,
 * success toast). Matches Solar's 1.5 stroke; colour comes from `currentColor`.
 */
function SuccessCheck({ className, ...props }: React.ComponentProps<typeof motion.svg>) {
  return (
    <motion.svg
      data-slot="success-check"
      viewBox="0 0 24 24"
      fill="none"
      stroke="currentColor"
      strokeWidth={1.5}
      strokeLinecap="round"
      strokeLinejoin="round"
      aria-hidden
      className={cn("size-4 shrink-0", className)}
      initial={{ opacity: 0, rotate: -35, scale: 0.6, y: 2 }}
      animate={{ opacity: 1, rotate: 0, scale: 1, y: 0 }}
      transition={spring.bouncy}
      {...props}
    >
      <motion.circle
        cx={12}
        cy={12}
        r={9.25}
        initial={{ pathLength: 0 }}
        animate={{ pathLength: 1 }}
        transition={{ duration: 0.35, ease: ease.out }}
      />
      <motion.path
        d="M8.25 12.25 10.75 14.75 15.75 9.25"
        initial={{ pathLength: 0 }}
        animate={{ pathLength: 1 }}
        transition={{ duration: 0.25, delay: 0.2, ease: ease.out }}
      />
    </motion.svg>
  )
}

export { SuccessCheck }