Backgrounds

Animated Spotlight

Animated spotlight effect with customizable gradients and movement.

The AnimatedSpotlight component creates an animated spotlight effect with customizable gradients and movement. It's perfect for adding dynamic lighting effects to your UI.

Usage

Animated spotlight effect

Animated spotlight effect

<template>
  <UCard class="relative">
    <template #header>
      <h2 class="text-xl font-semibold">
        Animated spotlight effect
      </h2>
    </template>
    <p class="text-muted mb-4">
      Animated spotlight effect
    </p>
    <MAnimatedSpotlight />
  </UCard>
</template>

Examples

Basic Animated Spotlight

Spotlight Search

Focus attention on key elements with our animated spotlight effect that guides users through your interface

<template>
  <div class="relative h-96 rounded-xl overflow-hidden border border-default bg-gradient-to-br from-gray-900 via-blue-900 to-purple-900">
    <MAnimatedSpotlight
      :translate-y="-200"
      :width="400"
      :height="1000"
      class="absolute inset-0"
    />
    <div class="relative z-10 h-full flex flex-col items-center justify-center text-center p-6">
      <div class="w-20 h-20 rounded-full bg-default/10 backdrop-blur-sm flex items-center justify-center mb-6">
        <UIcon
          name="i-lucide-search"
          class="w-10 h-10 text-white"
        />
      </div>
      <h3 class="text-3xl font-bold text-white mb-4">
        Spotlight Search
      </h3>
      <p class="text-dimmed max-w-md mb-8">
        Focus attention on key elements with our animated spotlight effect that guides users through your interface
      </p>
      <div class="flex flex-col sm:flex-row gap-4">
        <UButton
          color="primary"
          variant="solid"
          size="lg"
        >
          Try It Now
        </UButton>
        <UButton
          color="neutral"
          variant="outline"
          size="lg"
        >
          View Demo
        </UButton>
      </div>
    </div>
  </div>
</template>

Customize

Customize

Gradient Firstradial-gradient(68.54% 68.72% at 55.02% 31.46%, hsla(210, 100%, 85%, .08) 0, hsla(210, 100%, 55%, .02) 50%, hsla(210, 100%, 45%, 0) 80%)
Gradient Secondradial-gradient(50% 50% at 50% 50%, hsla(210, 100%, 85%, .06) 0, hsla(210, 100%, 55%, .02) 80%, transparent 100%)
Gradient Thirdradial-gradient(50% 50% at 50% 50%, hsla(210, 100%, 85%, .04) 0, hsla(210, 100%, 45%, .02) 80%, transparent 100%)
Translate Y-350
Width560
Height1380
Small Width240
Duration7
X Offset100

Props

Prop Type Default Description
gradientFirststring'radial-gradient(68.54% 68.72% at 55.02% 31.46%, hsla(210, 100%, 85%, .08) 0, hsla(210, 100%, 55%, .02) 50%, hsla(210, 100%, 45%, 0) 80%)'First gradient for the spotlight effect.
gradientSecondstring'radial-gradient(50% 50% at 50% 50%, hsla(210, 100%, 85%, .06) 0, hsla(210, 100%, 55%, .02) 80%, transparent 100%)'Second gradient for the spotlight effect.
gradientThirdstring'radial-gradient(50% 50% at 50% 50%, hsla(210, 100%, 85%, .04) 0, hsla(210, 100%, 45%, .02) 80%, transparent 100%)'Third gradient for the spotlight effect.
translateYnumber-350Vertical translation of the spotlight.
widthnumber560Width of the spotlight in pixels.
heightnumber1380Height of the spotlight in pixels.
smallWidthnumber240Width of the smaller spotlight elements.
durationnumber7Duration of the animation in seconds.
xOffsetnumber100Horizontal offset for the animation.

UI

This component's theme exposes the slots below. Override any of them per instance with the ui prop, or app-wide under ui.animatedSpotlight in app.config.ts.

Prop Type Default Description
uiobject-Per-slot classes merged over the theme defaults.
Slot Props Description
root-pointer-events-none absolute inset-0 h-full w-full
left-absolute top-0 left-0 w-screen h-screen z-40 pointer-events-none
leftFirst-absolute top-0 left-0
leftSecond-absolute top-0 left-0 origin-top-left
leftThird-absolute top-0 left-0 origin-top-left
right-absolute top-0 right-0 w-screen h-screen z-40 pointer-events-none
rightFirst-absolute top-0 right-0
rightSecond-absolute top-0 right-0 origin-top-right
rightThird-absolute top-0 right-0 origin-top-right
Copyright © 2026