Ballmac UI home

Tilt Card

A card that tilts in 3D toward the pointer with spring smoothing and a moving glare. TiltCardLayer children float at their own depth for parallax. Keyboard focus shows a gentle tilt.

BallmacPRO
MEMBERJordan Avery•••• 2048Since 2024

Installation

$ pnpm dlx shadcn@latest add @ballmac/tilt-card

Usage

import { TiltCard, TiltCardLayer } from "@/components/ballmac/tilt-card"

The full example is in the Code tab above.

Examples

Linked product card

API reference

<TiltCard>

PropTypeDefault
maxTilt

Largest rotation on each axis, in degrees.

number10
perspective

Distance of the viewer in pixels. Smaller values exaggerate depth.

number900
hoverScale

Scale while the pointer is over the card.

number1.02
glare

Draw a soft light highlight that follows the pointer.

booleantrue
glareOpacity

Peak opacity of the glare, 0 to 1.

number0.28
style

Inline styles for the card.

React.CSSProperties—

<TiltCardLayer>

PropTypeDefault
depth

How far the layer floats above the card, in pixels. Larger values move more with the tilt.

number24

Also accepts the standard attributes of its root element.

Accessibility

KeyAction
TabFocusing the card (tabIndex) or a link inside it shows a gentle fixed tilt

Use with AI

<TiltCard> is a card surface (rounded-xl, border, bg-card) that rotates toward the pointer; wrap parts in <TiltCardLayer depth={24}> to lift them off the surface. The card sets --tilt-x and --tilt-y (0%–100%) for custom foil or gradient effects. With the shadcn MCP server set up (guide), ask your agent:

Add the Ballmac UI Tilt Card (@ballmac/tilt-card) to this project with the shadcn MCP, then use it where it fits.

Use it for

  • A single hero object: a membership or gift card, a product box, an app icon
  • Pricing or product cards on a landing page that should feel physical
  • Collectible or badge-style achievements

Not for

  • Dense grids of many cards (the motion competes; use spotlight-card)
  • Cards holding forms or text people need to read while moving the pointer

Registry JSON: https://ui.ballmac.com/r/tilt-card.json

Credits

Free to use in personal and commercial projects.