Perspective Tilt
A 3D card with perspective-driven tilt and cinematic focus-blur transitions for smooth card entry and exit animations.
Installation
bunx --bun shadcn@latest add "https://ratneshc.com/r/perspective-tilt.json"
Usage
import {
PerspectiveTilt,
PerspectiveTiltTrigger,
PerspectiveTiltContent,
} from "@/components/perspective-tilt";<PerspectiveTilt>
<PerspectiveTiltTrigger>Open</PerspectiveTiltTrigger>
<PerspectiveTiltContent>
{/* Your content here */}
</PerspectiveTiltContent>
</PerspectiveTilt>Composition
Use the following composition to build a PerspectiveTilt:
PerspectiveTilt
├── PerspectiveTiltTrigger
└── PerspectiveTiltContentAPI Reference
PerspectiveTilt
The root component that manages the open/close state.
| Prop | Type | Default | Description |
|---|---|---|---|
open | boolean | - | The controlled open state of the dialog. |
onOpenChange | (open: boolean) => void | - | Event handler called when the open state changes. |
children | ReactNode | - | The components to be wrapped by the context. |
PerspectiveTiltTrigger
The component that toggles the open state.
| Prop | Type | Default | Description |
|---|---|---|---|
asChild | boolean | false | When true, merges its props onto its immediate child. |
className | string | - | Custom styling for the trigger element. |
children | ReactNode | - | The element that triggers the dialog on click. |
PerspectiveTiltContent
The component that renders the animated card content.
| Prop | Type | Default | Description |
|---|---|---|---|
className | string | - | Custom styling for the modal content card. |
children | ReactNode | - | The content to be rendered within the card. |