erictsai83

Heartbeat

Component

About

A Motion-powered heartbeat primitive with a projected shadow layer and reduced-motion support.

Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Heartbeat to your project and fits it to your theme.

Code

How Heartbeat is used: the demo's code. The component's own source comes with a free account.

Usage.tsx

"use client";

import type * as React from "react";

import { Heartbeat } from "@/components/ui/ericts-heartbeat";

export default function Preview() {
  return (
        <Heartbeat
          aria-label="Beating heart"
          className="size-24 text-foreground"
          shadowClassName="text-foreground/70"
        >
          <LogoIcon className="size-full" />
        </Heartbeat>
  );
}

// ericts/ui site logo (components/icons.tsx)
const LogoIcon = (props: React.ComponentProps<"svg">) => (
  <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" {...props}>
    <rect width="256" height="256" fill="none" />
    <path
      d="M128 224.6l-8.8-7.8C54 158.8 16 124 16 78.4 16 46 39.2 24 72 24c22.8 0 41.8 13.2 56 36 14.2-22.8 33.2-36 56-36 32.8 0 56 22 56 54.4 0 45.6-38 80.4-103.2 138.4L128 224.6z"
      fill="none"
      stroke="currentColor"
      strokeWidth="16"
      strokeLinecap="round"
      strokeLinejoin="round"
    />
    <line
      x1="192"
      y1="112"
      x2="144"
      y2="160"
      fill="none"
      stroke="currentColor"
      strokeLinecap="round"
      strokeLinejoin="round"
      strokeWidth="16"
    />
    <line
      x1="192"
      y1="64"
      x2="96"
      y2="160"
      fill="none"
      stroke="currentColor"
      strokeLinecap="round"
      strokeLinejoin="round"
      strokeWidth="16"
    />
  </svg>
);

Dependencies

More by erictsai83

View all
  • Adaptive Drawer

    Adaptive Drawer

  • Status Button

    Status Button

  • Floating Shortcut Button

    Floating Shortcut Button

  • Filter Tags

    Filter Tags

  • Feedback Popover

    Feedback Popover

  • Expandable Toolbar

    Expandable Toolbar

  • Expandable Toggle Button

    Expandable Toggle Button

  • Arc Menu

    Arc Menu