Staaarter

3D Tilt Card CTA

A photo-backed call-to-action card that tilts in 3D perspective as the cursor moves across it, zooms its background image slightly on hover, and sweeps a diagonal shine of light across the surface. Great for a single, high-impact conversion moment.

By Staaarter Team
CTA
Docs
Live preview

Docs

Installation

A real shadcn registry command, not a copy-paste stand-in: it fetches this block plus its button, media-slot dependencies and any missing npm packages, and installs them straight into your project.

npx shadcn add https://staaarter.com/r/3d-tilt-card-cta.json

Prefer not to use the CLI? Copy the source from the Code toggle above into src/components/blocks/cta/cta45.tsx instead.

Usage

The file also exports cta45Demo, the exact props behind the preview above. Spread it to get a working section in one line, then replace it with your own data.

import { Cta45, cta45Demo } from "@/components/blocks/cta/cta45";

export default function Page() {
  return <Cta45 {...cta45Demo} />;
}

Props

PropTypeDefaultDescription
headingstring"See it in action"Heading overlaid on the card.
descriptionstring"A card that responds to how you look at it..."Supporting copy under the heading.
primaryLabelstring"Explore the demo"Call-to-action button label.
primaryHrefstring"#"Link target for the call-to-action button.
image{ src: string; alt: string }noneBackground photo. Falls back to a placeholder when omitted.
classNamestringnoneExtra classes for the outer section element.

Behavior notes

  • The 3D tilt is a real, mouse-driven effect: an onMouseMove handler computes the cursor's position relative to the card's bounding box and derives rotateX/rotateY (up to ±8deg), applied via an inline perspective/rotate transform. onMouseLeave resets the tilt back to flat.
  • The background image's zoom-on-hover (group-hover:scale-105) and the diagonal shine sweep (a pure-CSS @keyframes animation triggered by :hover) are both decorative: neither responds to cursor position, only to whether the pointer is anywhere over the card.
  • The call-to-action button is decorative: it renders as a real Next.js Link via the button's render prop, but defaults to "#" and doesn't perform a real navigation of its own.