> ## Documentation Index
> Fetch the complete documentation index at: https://hyperframes-fix-nested-composition-media-inpoint.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# X Post Card

> Animated X/Twitter post card overlay with engagement metrics

export const InstallCommand = ({command, item}) => {
  const [copied, setCopied] = React.useState(false);
  const [tuned, setTuned] = React.useState("");
  React.useEffect(() => {
    if (!item) return;
    const read = () => {
      try {
        const raw = new URLSearchParams(window.location.search).get(`vars-${item}`);
        if (!raw) return setTuned("");
        const parsed = JSON.parse(raw);
        if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) return setTuned("");
        if (Object.keys(parsed).length === 0) return setTuned("");
        setTuned(` --vars '${JSON.stringify(parsed)}'`);
      } catch {
        setTuned("");
      }
    };
    read();
    window.addEventListener("hf-vars-changed", read);
    window.addEventListener("popstate", read);
    return () => {
      window.removeEventListener("hf-vars-changed", read);
      window.removeEventListener("popstate", read);
    };
  }, [item]);
  const fullCommand = `${command}${tuned}`;
  const copy = async () => {
    try {
      if (navigator.clipboard && window.isSecureContext) {
        await navigator.clipboard.writeText(fullCommand);
      } else {
        const previous = document.activeElement;
        const scratch = document.createElement("textarea");
        scratch.value = fullCommand;
        scratch.setAttribute("readonly", "");
        scratch.style.position = "fixed";
        scratch.style.opacity = "0";
        document.body.appendChild(scratch);
        scratch.select();
        document.execCommand("copy");
        document.body.removeChild(scratch);
        previous?.focus?.();
      }
      setCopied(true);
      setTimeout(() => setCopied(false), 2000);
    } catch {}
  };
  return <div className="hf-install-command not-prose my-4 flex items-stretch overflow-hidden rounded-xl border border-zinc-200 bg-zinc-50 dark:border-zinc-800 dark:bg-zinc-900">
      <code className="flex-1 overflow-x-auto whitespace-nowrap border-r border-zinc-200 px-4 py-3 font-mono text-sm text-zinc-800 dark:border-zinc-800 dark:text-zinc-100">
        {fullCommand}
      </code>
      <button type="button" onClick={copy} data-copied={copied ? "true" : "false"} aria-label={`Copy ${command} to the clipboard`} className="hf-install-copy">
        <svg className="hf-install-copy-clipboard" xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 18 18" fill="none" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true">
          <path d="M14.25 5.25H7.25C6.14543 5.25 5.25 6.14543 5.25 7.25V14.25C5.25 15.3546 6.14543 16.25 7.25 16.25H14.25C15.3546 16.25 16.25 15.3546 16.25 14.25V7.25C16.25 6.14543 15.3546 5.25 14.25 5.25Z" />
          <path d="M2.80103 11.998L1.77203 5.07397C1.61003 3.98097 2.36403 2.96397 3.45603 2.80197L10.38 1.77297C11.313 1.63397 12.19 2.16297 12.528 3.00097" />
        </svg>
        <svg className="hf-install-copy-check" xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 18 18" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true">
          <path d="M2.75 9.5L6.5 13.25L15.25 4.5" />
        </svg>
      </button>
      <span className="hf-install-copy-status" role="status" aria-live="polite">
        {copied ? "Copied" : ""}
      </span>
    </div>;
};

<iframe className="w-full aspect-video rounded-xl border-0 bg-zinc-100 dark:bg-zinc-800" title="x-post preview" loading="lazy" srcDoc={`<!doctype html><html><head><meta charset="utf-8"><style>html,body{margin:0;height:100%;overflow:hidden;background:transparent}hyperframes-player{display:block;width:100%;height:100%}</style><script src="https://cdn.jsdelivr.net/npm/@hyperframes/player@0.7/dist/hyperframes-player.global.js"><\/script></head><body><script>fetch("/public/catalog/blocks/x-post.json").then(function(r){return r.json()}).then(function(d){var p=document.createElement("hyperframes-player");p.setAttribute("srcdoc",d.html);p.setAttribute("controls","");p.setAttribute("autoplay","");p.setAttribute("loop","");p.setAttribute("muted","");p.setAttribute("poster","https://static.heygen.ai/hyperframes-oss/docs/images/catalog/blocks/x-post.png");document.body.appendChild(p)});<\/script></body></html>`} />

## Install

<InstallCommand command="npx hyperframes add x-post" item="x-post" />

That writes one file: `compositions/x-post.html`.

## Source

<Accordion title={`x-post.html`}>
  ```html theme={null}
  <!doctype html>
  <html lang="en">
    <head>
      <meta charset="UTF-8" />
      <link rel="preconnect" href="https://fonts.googleapis.com" />
      <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
      <link
        href="https://fonts.googleapis.com/css2?family=Inter:wght@400;700&display=block"
        rel="stylesheet"
      />
      <script src="https://cdn.jsdelivr.net/npm/gsap@3.14.2/dist/gsap.min.js"></script>
      <style>
        * {
          margin: 0;
          padding: 0;
          box-sizing: border-box;
        }
        html,
        body {
          background: transparent;
          overflow: hidden;
        }
        body {
          width: 1920px;
          height: 1080px;
          font-family: "Inter", sans-serif;
        }

        [data-composition-id="x-post"] .x-card {
          position: absolute;
          top: 50%;
          left: 50%;
          transform: translate(-50%, -50%);
          width: 880px;
          background: #15202b;
          border-radius: 20px;
          padding: 36px 36px 28px;
          box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
          border: 1px solid #38444d;
          overflow: hidden;
        }

        /* Bottom glow */
        [data-composition-id="x-post"] .x-card::after {
          content: "";
          position: absolute;
          bottom: 0;
          left: 0;
          right: 0;
          height: 80px;
          background: linear-gradient(to top, rgba(29, 155, 240, 0.08), transparent);
          pointer-events: none;
        }

        /* Header row */
        [data-composition-id="x-post"] .post-header {
          display: flex;
          align-items: flex-start;
          gap: 14px;
          margin-bottom: 18px;
          position: relative;
        }

        [data-composition-id="x-post"] .avatar {
          width: 52px;
          height: 52px;
          flex-shrink: 0;
          border-radius: 50%;
          overflow: hidden;
        }

        [data-composition-id="x-post"] .avatar svg {
          width: 52px;
          height: 52px;
          display: block;
        }

        [data-composition-id="x-post"] .user-info {
          display: flex;
          flex-direction: column;
          gap: 2px;
          flex: 1;
        }

        [data-composition-id="x-post"] .name-row {
          display: flex;
          align-items: center;
          gap: 6px;
        }

        [data-composition-id="x-post"] .display-name {
          font-size: 26px;
          font-weight: 700;
          color: #e7e9ea;
          line-height: 1.3;
        }

        [data-composition-id="x-post"] .verified-badge svg {
          width: 22px;
          height: 22px;
          display: block;
        }

        [data-composition-id="x-post"] .handle {
          font-size: 22px;
          font-weight: 400;
          color: #8b98a5;
          line-height: 1.3;
        }

        /* X logo top-right */
        [data-composition-id="x-post"] .x-logo {
          position: absolute;
          top: 2px;
          right: 0;
          width: 32px;
          height: 32px;
        }

        [data-composition-id="x-post"] .x-logo svg {
          width: 32px;
          height: 32px;
          display: block;
        }

        /* Tweet body */
        [data-composition-id="x-post"] .tweet-body {
          font-size: 30px;
          font-weight: 400;
          color: #e7e9ea;
          line-height: 1.45;
          margin-bottom: 12px;
          display: -webkit-box;
          -webkit-line-clamp: 4;
          -webkit-box-orient: vertical;
          overflow: hidden;
        }

        [data-composition-id="x-post"] .hashtag {
          color: #1d9bf0;
        }

        /* Timestamp */
        [data-composition-id="x-post"] .timestamp {
          font-size: 22px;
          color: #8b98a5;
          padding-bottom: 20px;
          border-bottom: 1px solid #38444d;
          margin-bottom: 16px;
        }

        /* Metrics bar — matches real X spacing */
        [data-composition-id="x-post"] .metrics-bar {
          display: flex;
          align-items: center;
          padding: 0;
          position: relative;
          z-index: 1;
        }

        [data-composition-id="x-post"] .metrics-left {
          display: flex;
          align-items: center;
          flex: 1;
          justify-content: space-between;
          padding-right: 60px;
        }

        [data-composition-id="x-post"] .metrics-right {
          display: flex;
          align-items: center;
          gap: 20px;
        }

        [data-composition-id="x-post"] .metric {
          display: flex;
          align-items: center;
          gap: 8px;
        }

        [data-composition-id="x-post"] .metric-icon {
          width: 35px;
          height: 35px;
          display: flex;
          align-items: center;
          justify-content: center;
        }

        [data-composition-id="x-post"] .metric-icon svg {
          width: 35px;
          height: 35px;
          display: block;
        }

        [data-composition-id="x-post"] .metric-count {
          font-size: 20px;
          font-weight: 400;
          color: #8b98a5;
        }
      </style>
    </head>
    <body>
      <div
        id="root"
        data-composition-id="x-post"
        data-width="1920"
        data-height="1080"
        data-start="0"
        data-duration="5"
      >
        <div id="card" class="clip x-card" data-start="0" data-duration="5" data-track-index="0">
          <!-- Header: prompt to replace display name, handle, and avatar -->
          <div class="post-header">
            <div class="avatar">
              <svg viewBox="0 0 52 52" fill="none">
                <circle cx="26" cy="26" r="26" fill="#536471" />
                <circle cx="26" cy="21" r="10" fill="#8b98a5" />
                <ellipse cx="26" cy="42" rx="16" ry="12" fill="#8b98a5" />
              </svg>
            </div>
            <div class="user-info">
              <div class="name-row">
                <span class="display-name">Hyperframes</span>
                <span class="verified-badge">
                  <svg viewBox="0 0 22 22" fill="none">
                    <circle cx="11" cy="11" r="11" fill="#1d9bf0" />
                    <path
                      d="M9.5 14.25L6.25 11l1.06-1.06 2.19 2.19 4.69-4.69L15.25 8.5 9.5 14.25z"
                      fill="#fff"
                    />
                  </svg>
                </span>
              </div>
              <span class="handle">@hyperframes</span>
            </div>
            <div class="x-logo">
              <svg viewBox="0 0 24 24" fill="#e7e9ea">
                <path
                  d="M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z"
                />
              </svg>
            </div>
          </div>

          <!-- Tweet body: prompt to replace with your content -->
          <div class="tweet-body">
            Prompt to replace this text with your tweet. Change the display name, handle, timestamp,
            and engagement counts to match your content. <span class="hashtag">#YourHashtag</span>
          </div>

          <!-- Timestamp: prompt to replace -->
          <div class="timestamp">1:10 PM &middot; Apr 7, 2026</div>

          <!-- Metrics bar -->
          <div class="metrics-bar">
            <div class="metrics-left">
              <!-- Reply -->
              <div class="metric">
                <div class="metric-icon">
                  <svg viewBox="0 0 24 24" fill="#8b98a5">
                    <path
                      d="M1.751 10c0-4.42 3.584-8 8.005-8h4.366c4.49 0 8.129 3.64 8.129 8.13 0 2.96-1.607 5.68-4.196 7.11l-8.054 4.46v-3.69h-.067c-4.49.1-8.183-3.51-8.183-8.01zm8.005-6c-3.317 0-6.005 2.69-6.005 6 0 3.37 2.77 6.08 6.138 6.01l.351-.01h1.761v2.3l5.087-2.81c1.951-1.08 3.163-3.13 3.163-5.36 0-3.39-2.744-6.13-6.129-6.13H9.756z"
                    />
                  </svg>
                </div>
                <span class="metric-count">34</span>
              </div>

              <!-- Repost -->
              <div class="metric">
                <div class="metric-icon">
                  <svg viewBox="0 0 24 24" fill="#8b98a5">
                    <path
                      d="M4.5 3.88l4.432 4.14-1.364 1.46L5.5 7.55V16c0 1.1.896 2 2 2H13v2H7.5c-2.209 0-4-1.79-4-4V7.55L1.432 9.48.068 8.02 4.5 3.88zM16.5 6H11V4h5.5c2.209 0 4 1.79 4 4v8.45l2.068-1.93 1.364 1.46-4.432 4.14-4.432-4.14 1.364-1.46 2.068 1.93V8c0-1.1-.896-2-2-2z"
                    />
                  </svg>
                </div>
                <span class="metric-count">2.3K</span>
              </div>

              <!-- Like -->
              <div id="like-btn" class="metric">
                <div class="metric-icon">
                  <svg viewBox="0 0 24 24">
                    <!-- Outline heart (visible initially) -->
                    <path
                      id="heart-outline"
                      d="M16.697 5.5c-1.222-.06-2.679.51-3.89 2.16l-.805 1.09-.806-1.09C9.984 6.01 8.526 5.44 7.304 5.5c-1.243.07-2.349.78-2.91 1.91-.552 1.12-.633 2.78.479 4.82 1.074 1.97 3.257 4.27 7.129 6.61 3.87-2.34 6.052-4.64 7.126-6.61 1.111-2.04 1.03-3.7.477-4.82-.561-1.13-1.666-1.84-2.908-1.91zm4.187 7.69c-1.351 2.48-4.001 5.12-8.379 7.67l-.503.3-.504-.3c-4.379-2.55-7.029-5.19-8.382-7.67-1.36-2.5-1.41-4.86-.514-6.67.887-1.79 2.647-2.91 4.601-3.01 1.651-.09 3.368.56 4.798 2.01 1.429-1.45 3.146-2.1 4.796-2.01 1.954.1 3.714 1.22 4.601 3.01.896 1.81.846 4.17-.514 6.67z"
                      fill="#8b98a5"
                    />
                    <!-- Filled heart (hidden initially, shown on like) -->
                    <path
                      id="heart-filled"
                      d="M20.884 13.19c-1.351 2.48-4.001 5.12-8.379 7.67l-.503.3-.504-.3c-4.379-2.55-7.029-5.19-8.382-7.67-1.36-2.5-1.41-4.86-.514-6.67.887-1.79 2.647-2.91 4.601-3.01 1.651-.09 3.368.56 4.798 2.01 1.429-1.45 3.146-2.1 4.796-2.01 1.954.1 3.714 1.22 4.601 3.01.896 1.81.846 4.17-.514 6.67z"
                      fill="#f91880"
                      opacity="0"
                    />
                  </svg>
                </div>
                <span id="like-count" class="metric-count">10.9K</span>
              </div>

              <!-- Views -->
              <div class="metric">
                <div class="metric-icon">
                  <svg viewBox="0 0 24 24" fill="#8b98a5">
                    <path
                      d="M8.75 21V3h2v18h-2zM18 21V8.5h2V21h-2zM4 21l.004-10h2L6 21H4zm9.248 0v-7h2v7h-2z"
                    />
                  </svg>
                </div>
                <span class="metric-count">150K</span>
              </div>
            </div>

            <div class="metrics-right">
              <!-- Bookmark -->
              <div class="metric">
                <div class="metric-icon">
                  <svg viewBox="0 0 24 24" fill="#8b98a5">
                    <path
                      d="M4 4.5C4 3.12 5.119 2 6.5 2h11C18.881 2 20 3.12 20 4.5v18.44l-8-5.71-8 5.71V4.5zM6.5 4c-.276 0-.5.22-.5.5v14.56l6-4.29 6 4.29V4.5c0-.28-.224-.5-.5-.5h-11z"
                    />
                  </svg>
                </div>
              </div>

              <!-- Share -->
              <div class="metric">
                <div class="metric-icon">
                  <svg viewBox="0 0 24 24" fill="#8b98a5">
                    <path
                      d="M12 2.59l5.7 5.7-1.41 1.42L13 6.41V16h-2V6.41l-3.3 3.3-1.41-1.42L12 2.59zM21 15l-.02 3.51c0 1.38-1.12 2.49-2.5 2.49H5.5C4.11 21 3 19.88 3 18.5V15h2v3.5c0 .28.22.5.5.5h12.98c.28 0 .5-.22.5-.5L19 15h2z"
                    />
                  </svg>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>

      <script>
        window.__timelines = window.__timelines || {};

        var tl = gsap.timeline({ paused: true });

        var card = document.getElementById("card");
        var likeBtn = document.getElementById("like-btn");
        var heartOutline = document.getElementById("heart-outline");
        var heartFilled = document.getElementById("heart-filled");
        var likeCount = document.getElementById("like-count");

        // Start off-screen below
        gsap.set(card, { y: 400, opacity: 0 });

        // Slide in from bottom
        tl.to(
          card,
          {
            y: 0,
            opacity: 1,
            duration: 0.6,
            ease: "power3.out",
          },
          0.1,
        );

        // Like press-in
        tl.to(
          likeBtn,
          {
            scale: 0.85,
            duration: 0.12,
            ease: "power2.out",
          },
          1.5,
        );

        // Like release with spring bounce
        tl.to(
          likeBtn,
          {
            scale: 1,
            duration: 0.4,
            ease: "elastic.out(1, 0.4)",
          },
          1.62,
        );

        // Hide outline heart
        tl.to(
          heartOutline,
          {
            opacity: 0,
            duration: 0.01,
            ease: "none",
          },
          1.62,
        );

        // Show filled heart
        tl.to(
          heartFilled,
          {
            opacity: 1,
            duration: 0.12,
            ease: "none",
          },
          1.62,
        );

        // Like count turns pink + increments
        tl.to(
          likeCount,
          {
            color: "#f91880",
            duration: 0.12,
            ease: "none",
            onStart: function () {
              likeCount.textContent = "11.0K";
            },
          },
          1.62,
        );

        // Slide out to bottom
        tl.to(
          card,
          {
            y: 400,
            opacity: 0,
            duration: 0.3,
            ease: "power3.in",
          },
          4.2,
        );

        window.__timelines["x-post"] = tl;
      </script>
    </body>
  </html>
  ```
</Accordion>

## Usage

After installing, add the block to your host composition:

```html theme={null}
<div data-composition-id="x-post" data-composition-src="compositions/x-post.html" data-start="0" data-duration="5" data-track-index="1" data-width="1920" data-height="1080"></div>
```

Tagged `social` `overlay` `twitter`.

## Related topics

* [Browse the complete Catalog](/catalog)
* [Add assets and Catalog items in Studio](/studio/assets-and-blocks)
* [Build a richer composition](/go-further)
