Interactive
3D Card
Interactive 3D perspective card with smooth hover transforms. Perfect for React applications requiring immersive UI elements with Next.js integration and TypeScript support.
Installation
npx shadcn@latest add https://www.shadcn.io/registry/3d-card.json
npx shadcn@latest add https://www.shadcn.io/registry/3d-card.json
pnpm dlx shadcn@latest add https://www.shadcn.io/registry/3d-card.json
bunx shadcn@latest add https://www.shadcn.io/registry/3d-card.json
Features
- Mouse-responsive transforms with real-time perspective calculations based on cursor position
- Smooth hover animations using CSS 3D transforms and transition effects
- Flexible content positioning with customizable translateX, translateY, translateZ values
- Individual item control with independent rotation and translation properties
- TypeScript support with comprehensive type definitions and props interface
- Responsive design compatible with shadcn/ui design system and Tailwind CSS
Examples
Interactive Variant
Enhanced version showcasing additional transform properties and rotation effects.
Use Cases
This free open source React component works well for:
- Product showcases - Interactive cards displaying features built with Next.js
- Portfolio items - Creative presentations using TypeScript and Tailwind CSS
- Hero sections - Engaging landing page elements with 3D effects
- Dashboard widgets - Interactive data cards for modern applications
API Reference
CardContainer
Prop | Type | Default | Description |
---|---|---|---|
children | React.ReactNode | undefined | Card content elements |
className | string | undefined | CSS classes for the card container |
containerClassName | string | undefined | CSS classes for the outer wrapper |
CardBody
Prop | Type | Default | Description |
---|---|---|---|
children | React.ReactNode | required | Content to be rendered inside the card body |
className | string | undefined | CSS classes for styling the card body |
CardItem
Prop | Type | Default | Description |
---|---|---|---|
as | React.ElementType | "div" | HTML element type to render |
children | React.ReactNode | required | Content to be rendered inside the item |
className | string | undefined | CSS classes for styling |
translateX | number | string | 0 | X-axis translation in pixels |
translateY | number | string | 0 | Y-axis translation in pixels |
translateZ | number | string | 0 | Z-axis translation in pixels |
rotateX | number | string | 0 | X-axis rotation in degrees |
rotateY | number | string | 0 | Y-axis rotation in degrees |
rotateZ | number | string | 0 | Z-axis rotation in degrees |
Implementation Notes
- Wrap content within
CardContainer
for proper 3D perspective context - Use
CardBody
as the main content wrapper with preserve-3d transform style - Individual
CardItem
components respond to hover state automatically - Transform values accept both numbers (pixels/degrees) and string values
- Compatible with all shadcn/ui components and design tokens
- Requires no additional CSS setup beyond Tailwind CSS classes
Image Zoom
Click-to-zoom image component for React and Next.js applications. Built with TypeScript support, Tailwind CSS styling, and shadcn/ui design featuring smooth transitions, backdrop blur, and mobile-friendly interactions.
3D Marquee
Animated 3D marquee with perspective grid transforms and smooth scrolling images. Perfect for React applications requiring immersive visual displays with Next.js integration and TypeScript support.