Componentdata0.69 KB gzipZero dependencies
Tilt Card
3D cursor-tracking tilt card with springy reset and glare highlight.
Preview
Live Preview
Installation
Tokens guide →Add to your project via CLI (zero dependencies, code you own):
npx bigbullui add tilt-cardOr install the full npm package:
npm install bigbulluiUsage
tsx3 lines
import { TiltCard } from "@/components/ui/tilt-card"; <TiltCard />Source code
tilt-card.tsx + 1 helperZero third-party dependencies (2 local files shown in tabs below).
tsxtilt-card.tsx62 lines
"use client"; import * as React from "react";import { cn } from "./lib/utils"; export interface TiltCardProps extends React.HTMLAttributes<HTMLDivElement> { /** Maximum tilt angle in degrees */ maxTilt?: number; /** Show glare shine overlay */ glare?: boolean;} /** 3D parallax tilt card tracking cursor with spring reset. */export function TiltCard({ maxTilt = 10, glare = true, className, children, ...props }: TiltCardProps) { const ref = React.useRef<HTMLDivElement>(null); const [transform, setTransform] = React.useState(""); const [glarePos, setGlarePos] = React.useState({ x: 50, y: 50, opacity: 0 }); Props
Interactive Prop Playground
Tweak parsed AST props below to generate ready-to-paste JSX.
tsx3 lines
import { TiltCard } from "@/components/ui/tilt-card"; <TiltCard />| Prop | Type | Description |
|---|---|---|
| maxTilt | number | Maximum tilt angle in degrees |
| glare | boolean | Show glare shine overlay |