SpotlightCard
SpotlightCard is a beautiful, interactive card component that creates a radial gradient spotlight effect following the user’s cursor. Perfect for highlighting important content with an engaging visual interaction.Overview
The component tracks mouse movement and creates a smooth, animated spotlight that follows the cursor position. It includes focus states for accessibility and provides customizable spotlight colors.Props
The content to be rendered inside the spotlight card.
Additional CSS classes to apply to the card container. These classes are appended to the default styling.
The color of the spotlight effect. Accepts any valid CSS color value, including rgba for transparency control.
Usage
Real-World Examples
Education Card (from About Me section)
Project Card (from Projects section)
Contact Form (from Contact section)
Features
Mouse Tracking
The spotlight smoothly follows the mouse cursor when hovering over the card, creating an engaging interactive experience.Focus States
The component includes proper focus handling for accessibility:- Spotlight appears on mouse enter
- Spotlight maintains position during focus
- Smooth opacity transitions (500ms duration)
Default Styling
The component comes with built-in styling including rounded corners, border, and backdrop blur. You can extend these styles using the
className prop.rounded-3xl- Rounded cornersborder border-neutral-800- Subtle borderbg-neutral-900- Dark backgroundoverflow-hidden- Clips spotlight effectp-8- Default padding
Customization Options
Color Themes
Size Variations
Accessibility
The component is fully accessible with:- Keyboard focus support
- Focus-visible states
- Smooth transitions for reduced motion preferences
- Proper event handling for mouse and keyboard interactions
Browser Compatibility
Works in all modern browsers that support:- CSS
backdrop-filterfor the blur effect - CSS custom properties
- Radial gradients
For older browsers without backdrop-filter support, consider providing a fallback background color.