Check Animation
ericts-ui/check-animationFreeComponent
A pure SVG checkmark animation that draws a square or circle before the check.
Live preview
live · rendered by the registry
Rendered by ericts-ui on their own page — this is the component running, not a screenshot of it.Install it
npx shadcn@latest add https://ui.ericts.com/r/check-animation.jsonSource
1import * as React from "react";23import { cn } from "@/lib/utils";45import "./check-animation.css";67export type CheckAnimationVariant = "square" | "circle";8export type CheckAnimationSize = "sm" | "md" | "lg";910export interface CheckAnimationProps11 extends Omit<React.ComponentPropsWithoutRef<"span">, "children"> {12 variant?: CheckAnimationVariant;13 size?: CheckAnimationSize;14 /** Accessible label. Omit for a decorative mark. */15 label?: string;16 strokeWidth?: number;17}1819const sizeClassNames: Record<CheckAnimationSize, string> = {20 sm: "size-5",21 md: "size-6",22 lg: "size-10",23};2425const DEFAULT_STROKE_WIDTH = 2;26const VECTOR_EFFECT = "non-scaling-stroke";27const SQUARE_PATH = "M 50,11.5 L 88.5,11.5 L 88.5,88.5 L 11.5,88.5 L 11.5,11.5 Z";28const CIRCLE_PATH =29 "M 88.5,50 C 88.5,71.26 71.26,88.5 50,88.5 C 28.74,88.5 11.5,71.26 11.5,50 C 11.5,28.74 28.74,11.5 50,11.5 C 71.26,11.5 88.5,28.74 88.5,50 Z";30const CHECK_PATH = "M 32.3,51 L 44,62.9 L 68.75,36.5";3132const shapePaths: Record<CheckAnimationVariant, string> = {33 square: SQUARE_PATH,34 circle: CIRCLE_PATH,35};3637export function CheckAnimation({38 variant = "square",39 size,40 label,41 strokeWidth = DEFAULT_STROKE_WIDTH,42 "aria-label": ariaLabel,43 "aria-hidden": ariaHidden,44 className,45 ...props46}: CheckAnimationProps) {47 const accessibleLabel = label ?? ariaLabel;4849 return (50 <span51 data-slot="check-animation"52 data-variant={variant}53 role={accessibleLabel ? "img" : undefined}54 aria-label={accessibleLabel}55 aria-hidden={accessibleLabel ? undefined : (ariaHidden ?? true)}56 className={cn(57 "check-animation inline-flex shrink-0 items-center justify-center text-foreground",58 size ? sizeClassNames[size] : "w-full max-w-80",59 className,60 )}61 {...props}62 >63 <svg64 viewBox="0 0 100 100"65 aria-hidden="true"66 className={size ? "size-full" : "h-auto w-full"}67 >68 <path69 className="check-animation-shape"70 d={shapePaths[variant]}71 fill="none"72 stroke="currentColor"73 strokeWidth={strokeWidth}74 strokeLinecap="round"75 strokeLinejoin="round"76 vectorEffect={VECTOR_EFFECT}77 pathLength="100"78 strokeDasharray="100 100"79 strokeDashoffset="100"80 />81 <path82 className="check-animation-checkmark"83 d={CHECK_PATH}84 fill="none"85 stroke="currentColor"86// … truncated
Files it writes
More from ericts-ui
All 38 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Adaptive Draweradaptive-drawer | ericts-ui | Components | Free | 2 deps | |
| Context Cursorcontext-cursor | ericts-ui | Components | Free | 1 dep | |
| Copy Buttoncopy-button | ericts-ui | Components | Free | 2 deps | |
| Expandable Dialogexpandable-modal | ericts-ui | Components | Free | 1 dep | |
| Expandable Tabsexpandable-tabs | ericts-ui | Components | Free | 1 dep | |
| Expandable Toolbarexpandable-toolbar | ericts-ui | Components | Free | 1 dep | |
| Expanding Panelexpanding-panel | ericts-ui | Components | Free | 2 deps | |
| Expanding Segmented Tabsexpanding-segmented-tabs | ericts-ui | Components | Free | 1 dep |
