# Tilt Card

> React card that tilts toward the pointer in 3D with a moving glare and parallax children marked data-depth. Springs flat on leave, still for reduced motion.

- Kind: Motion component (Motion)
- Docs: https://ui.minidev.pro/docs/tilt-card
- Source (registry JSON with the full file): https://ui.minidev.pro/r/tilt-card.json
- License: MIT. One file, yours to edit after install.

## When to use

Use it for a showcase card, a pricing hero or a product shot. Reach for CardTilt for a simpler tilt without glare or depth, and ShineBorder to draw the eye without motion.

## Installation

### shadcn CLI (copies the source into your project)

```bash
npx shadcn@latest add @minidev/tilt-card
```

Writes `components/ui/tilt-card.tsx` plus the MiniDev files it is built from (button) and installs its npm dependencies. Older CLI versions: `npx shadcn@latest add https://ui.minidev.pro/r/tilt-card.json`.

### npm package

```bash
npm i minidev-ui-kit lucide-react motion
```

Add the tokens to your global stylesheet once:

```css
@import "tailwindcss";
@import "minidev-ui-kit/styles.css";
@source "../node_modules/minidev-ui-kit";
```

Next.js also needs `transpilePackages: ["minidev-ui-kit"]` in next.config.

## Import

After the shadcn install:

```tsx
import { TiltCard } from "@/components/ui/tilt-card"
```

From the npm package:

```tsx
import { TiltCard } from "minidev-ui-kit/premium/tilt-card"
```

## Usage

```tsx
import { TiltCard } from "@/components/ui/tilt-card"

export function Example() {
  return (
    <TiltCard />
  )
}
```

## Props

| Prop | Type | Default | Required | Description |
| --- | --- | --- | --- | --- |
| `children` | `React.ReactNode` | - | no |  |
| `maxTilt` | `number` | `12` | no | Maximum rotation in degrees on either axis. |
| `glare` | `number` | `0.6` | no | Glare strength from 0 (off) to 1. |
| `perspective` | `number` | `900` | no | Perspective distance in pixels; smaller is more dramatic. |
| `parallax` | `number` | `10` | no | Pixels of travel for a child with `data-depth="1"`; scale the number for more or less. |
| `className` | `string` | - | no |  |

## Examples

### Custom content

Any children work; here a customer card with the figure and the action on their own layers.

```tsx
<TiltCard>
  <div data-depth="0.5" className="flex items-center justify-between">
    <span className="text-sm font-medium text-fg">Northwind Traders</span>
    <Badge variant="accent">Pro</Badge>
  </div>
  <p data-depth="1" className="mt-5 text-3xl font-medium tracking-[-0.03em] text-fg tabular-nums">$4,120.00</p>
  <p className="mt-1 text-sm text-fg-muted">Outstanding across 3 invoices</p>
  <div data-depth="1.2" className="mt-6">
    <Button variant="outline" className="w-full">Open customer <ArrowUpRightIcon /></Button>
  </div>
</TiltCard>
```

### Subtle tilt

Lower maxTilt and glare for cards in a grid, where a strong effect would fight the content.

```tsx
<TiltCard maxTilt={5} glare={0.25} parallax={4} />
```

### Deep parallax

A short perspective and a big parallax value make the layers float well clear of the card.

```tsx
<TiltCard perspective={600} parallax={24} className="w-72">
  <p data-depth="0.4" className="text-xs font-medium tracking-[0.06em] text-accent-fg uppercase">Lumen 3.0</p>
  <p data-depth="1" className="mt-3 text-2xl font-medium tracking-[-0.03em] text-fg">Invoices that close themselves</p>
  <p data-depth="0.6" className="mt-2 text-sm text-fg-muted">Reminders, receipts and reconciliation, handled.</p>
</TiltCard>
```

## Accessibility

- The glare is an `aria-hidden`, `pointer-events-none` span; buttons inside stay clickable.
- Under reduced motion the card stays flat, the glare is not rendered and `data-depth` transforms are cleared.

## FAQ

### How do I make parts of the card float above it?

Add `data-depth` to any descendant: `<h3 data-depth="1">`. It moves `parallax` pixels (default 10) per unit of depth with the pointer and lifts toward you while the card is lit. Layers are moved on the DOM directly, so React does not re-render.

### What happens on phones?

Touch pointers are ignored, so the card stays flat and scrolling passes straight through. A mouse or pen tilts it up to `maxTilt` degrees (default 12).

### TiltCard or CardTilt?

TiltCard adds a sliding glare, `data-depth` parallax and a `perspective` prop. [`CardTilt`](https://ui.minidev.pro/docs/card-tilt) is the simpler tilt with a soft glow and a built-in title and body.

## Rules for generating code

- Use semantic tokens only (bg, surface, sunken, border, fg, fg-muted, fg-subtle, ink, accent, success, warning, danger). Never raw hex or palette steps like blue-500.
- Shadows only from the set: shadow-xs, shadow-sm, shadow-raised, shadow-md, shadow-lg, shadow-overlay.
- Numbers use tabular-nums. Dark mode is the `dark` class on <html>; components never branch on theme.

## Dependencies

- npm: `lucide-react`, `motion`
- Built from: [button](https://ui.minidev.pro/docs/button/md)

## Related

- [Card Tilt](https://ui.minidev.pro/docs/card-tilt/md): A card that tilts in 3D toward the pointer on springs, with an accent glare that follows the cursor. It stays flat when reduced motion is preferred.
- [Shine Border](https://ui.minidev.pro/docs/shine-border/md): React shine border: a conic gradient sweeps around a card's edge, masked to the border ring so content stays untouched. Colors, duration and width props.
- [Parallax Panel](https://ui.minidev.pro/docs/parallax-panel/md): A panel where the heading text and a glowing accent orb move at different speeds as you scroll, giving scroll linked parallax depth with transforms only.
- [Animated Feature Row](https://ui.minidev.pro/docs/animated-feature-row/md): A row of feature cards that slide up with a staggered delay when scrolled into view. Pass title and description pairs; reduced motion keeps them still.
- [Cursor Spotlight Panel](https://ui.minidev.pro/docs/cursor-spotlight-panel/md): A panel whose accent radial spotlight follows the cursor, driven by Framer Motion values without re-renders. It shows a still surface for reduced motion.
- [Device Frame Stack](https://ui.minidev.pro/docs/device-frame-stack/md): Three device frames labelled mobile, app and docs that spring into a fanned, rotated stack when scrolled into view. Works as a hero or feature visual.

---

All 557 components: https://ui.minidev.pro/llms.txt (full text: https://ui.minidev.pro/llms-full.txt).
