Gradient Background

A background component featuring a subtle yet engaging animated gradient effect, smoothly transitioning colors to enhance visual depth.

<script setup lang="ts">
import GradientBackground from '@/components/animate-ui/backgrounds/gradient/GradientBackground.vue'
</script>

<template>
  <GradientBackground class="absolute inset-0" />
</template>

Installation

npx shadcn-vue@latest add https://animate-ui.com/r/vue/backgrounds-gradient.json
pnpm dlx shadcn-vue@latest add https://animate-ui.com/r/vue/backgrounds-gradient.json
yarn dlx shadcn-vue@latest add https://animate-ui.com/r/vue/backgrounds-gradient.json
bun x shadcn-vue@latest add https://animate-ui.com/r/vue/backgrounds-gradient.json

Usage

<script setup lang="ts">
import GradientBackground from '@/components/animate-ui/backgrounds/gradient/GradientBackground.vue';
</script>

<template>
  <section class="relative h-[480px] overflow-hidden">
    <GradientBackground class="absolute inset-0" />
  </section>
</template>

Animation

  • A large gradient slides back and forth behind the container (background-position), one round trip every 15s.
  • It pauses off screen and while the tab is hidden.
  • Under reduced motion, it holds its first frame.

API Reference

GradientBackground

PropTypeDefault
transition?
Transition{ duration: 15, ease: 'easeInOut', repeat: Infinity }
...attrs?
HTMLMotionProps<'div'>-

Built by Skyleen. The source code is available on GitHub.

Last updated: 10/23/2026