Card Spotlight

A card component with a dynamic spotlight effect that follows the mouse cursor, enhancing visual interactivity.

API

Prop NameTypeDefaultDescription
gradientSizenumber200Radius in pixels of the spotlight effect.
gradientColorstring'#262626'The color of the spotlight gradient.
gradientOpacitynumber0.8The opacity level of the spotlight gradient effect.
slotClassstringundefinedClass to apply to the parent container containing the slot.

Component Code

You can copy and paste the following code to create this component:

CardSpotlight.vue

Features

  • Interactive Spotlight Effect: Displays a dynamic spotlight that follows the user's mouse cursor, enhancing user engagement and visual appeal.
  • Customizable Appearance: Easily adjust the gradientSize, gradientColor, and gradientOpacity props to tailor the spotlight effect to your design preferences.
  • Easy Integration: Wrap any content within the <CardSpotlight> component to instantly add the spotlight effect without additional configuration.
  • Responsive Design: The component adapts smoothly to different container sizes, ensuring a consistent experience across various devices and screen sizes.
  • Performance Optimized: Utilizes Vue's reactivity for efficient updates, ensuring smooth animations without compromising application performance.

Credits

  • Inspired by Magic Card component from Magic UI.