Animated Modal
A beautiful animated modal component with backdrop blur, smooth animations, and customizable content. Perfect for React applications requiring user focus with Next.js integration and TypeScript support.
Powered by
Installation
npx shadcn@latest add https://www.shadcn.io/registry/animated-modal.json
npx shadcn@latest add https://www.shadcn.io/registry/animated-modal.json
pnpm dlx shadcn@latest add https://www.shadcn.io/registry/animated-modal.json
bunx shadcn@latest add https://www.shadcn.io/registry/animated-modal.json
Features
- Smooth 3D animations with spring physics and backdrop blur effects using Framer Motion
- Context-based state management with React Context for modal open/close state
- Outside click detection to automatically close modal when clicking outside content
- Customizable trigger buttons with hover effects and animation support
- TypeScript support with complete interface definitions and prop types
- shadcn/ui integration using Tailwind CSS design tokens and utilities
- Responsive design with mobile-friendly layouts and adaptive sizing
- Accessibility ready with focus management and keyboard navigation support
Use Cases
This free open source React component works well for:
- Confirmation dialogs - User action confirmations built with Next.js and TypeScript
- Content previews - Image galleries and detailed content views using Tailwind CSS
- Forms and wizards - Multi-step processes with modal workflows
- Product showcases - E-commerce product details with animated presentations
- Booking interfaces - Travel, appointment, and service booking forms
API Reference
Modal
The root modal component that provides context for all child components.
Prop | Type | Default | Description |
---|---|---|---|
children | ReactNode | required | Modal trigger and body components |
ModalTrigger
Button component that opens the modal when clicked.
Prop | Type | Default | Description |
---|---|---|---|
children | ReactNode | required | Content to display inside trigger button |
className | string | undefined | Additional CSS classes for styling |
ModalBody
Container for modal content with backdrop and animations.
Prop | Type | Default | Description |
---|---|---|---|
children | ReactNode | required | Modal content and footer components |
className | string | undefined | Additional CSS classes for modal container |
ModalContent
Main content area of the modal with padding and scroll support.
Prop | Type | Default | Description |
---|---|---|---|
children | ReactNode | required | Content to display inside modal |
className | string | undefined | Additional CSS classes for content area |
ModalFooter
Footer section for action buttons with consistent styling.
Prop | Type | Default | Description |
---|---|---|---|
children | ReactNode | required | Footer content (usually buttons) |
className | string | undefined | Additional CSS classes for footer |
Implementation Notes
- Component uses Framer Motion for smooth 3D perspective animations and spring physics
- Body scroll is automatically disabled when modal is open to prevent background scrolling
- Outside click detection closes modal automatically for better user experience
- Modal content is rendered in a portal with fixed positioning and high z-index
- Close button includes hover animations with scale and rotation effects
- All animations use hardware acceleration for optimal performance
Animated Cursor
Advanced animated cursor component with customizable following elements and spring animations. Perfect for React applications requiring interactive cursor effects with Next.js integration and TypeScript support.
Animated Testimonials
Interactive testimonials carousel with smooth image transitions and word-by-word text animations. Perfect for React applications showcasing customer feedback with Next.js integration and TypeScript support.