Skip to content

NewMCP server for your coding agent. Set it up ›

Nexus UI
Get Pro

Background Gradient, animated React component

Wraps a card or button in a slowly turning conic-gradient ring with a soft glow underneath. Hover and the ring spins up while its centre leans toward the pointer; press and the card squashes, springs back past its size and the glow flashes.

  • Free
  • Background Effects
  • Hover
  • Spring
  • Glow

Like Background Gradient? 256 more are in Pro.

Pro unlocks all 256 Pro components, every template and block, and everything we release next. Background Gradient stays free.

Play with it

Move the controls and watch it change. Copy code gives you a snippet with only the props you changed.

Pro

Popular

$18 / month

Unlimited projects, team seats and priority builds.

Props

PropTypeDefaultWhat it does
children—Content inside the ring.
className—Classes for the outer wrapper (width, layout).
containerClassName—Classes for the content wrapper; put padding here.
surfaceClassName—Classes for the inner surface. White, or #1c1c1e in dark mode, by default.
colors["#0a84ff", "#5e5ce6", "#bf5af2", "#ff375f", "#ff9f0a"]Ring colours in order round the edge. Two or more.
animationSpeed1Spin speed multiplier, 0.2 to 3.
blur24Blur of the glow under the card, in px.
borderRadius"24px"Corner radius of the wrapper.
ringWidth1.5Thickness of the gradient ring, in px.
as"div"Root element. "button" adds keyboard focus and press feedback.
interactivetrueSpin up and lean toward the pointer on hover, squash on press.
disabledfalseDisables the button variant.
onClick—Click handler for the button variant.
aria-label—Accessible name for the button variant when its content is not plain text.
autoplayfalseCircles a pretend pointer round the card until someone hovers it.

Add it to your project

  1. 1

    Set up your project once

    You need a Next.js project with Tailwind CSS and the @/ import alias. In its root folder, run this once. It creates components.json and the cn() helper in src/lib/utils.ts:

    npx shadcn@latest init -d

    Starting from nothing? The Quick Start walks through the whole thing.

  2. 2

    Connect the registry

    Run this once per project. It writes the Nexus UI entry into components.json for you:

    npx shadcn@latest registry add "@nexus-labs=https://www.nexus-ui.com/api/registry/{name}"

    Type it exactly as shown. {name} is filled in by the CLI with the component you ask for, so you never replace it.

  1. 3

    Add the component

    Run this from your project root. It adds the component, the helpers it imports and its npm packages.

    npx shadcn@latest add @nexus-labs/background-gradient
  2. 4

    Check what was added

    With a project made as in the Quick Start (a src/ folder), these files land in it:

    components/
    background-gradient.tsx
    background-gradient/
    background-gradient.tsx
    index.ts
  3. 5

    Copying by hand? Skip the registry

    Instead of steps 2 and 3 you can copy the files yourself, with no registry and no API key. Step 1 still applies, so that cn() exists. Install the packages:

    npm install framer-motion

    Then show the source and create each file at the path it gives:

  4. 6

    Use it in a page

    Installing only adds the files. Import the component in a page and render it. The Usage tab on the preview shows a fuller example with props:

    // src/app/page.tsx
    import { BackgroundGradient } from "@/components/background-gradient";
    
    export default function Page() {
      return (
        <main>
          <BackgroundGradient />
        </main>
      );
    }

Like Background Gradient? 256 more are in Pro.

Pro unlocks all 256 Pro components, every template and block, and everything we release next. Background Gradient stays free.

About Background Gradient

The Background Gradient component renders an animated radial or mesh gradient that shifts colors on a timer using CSS keyframe animation. Gradient stops, colors, position, and animation speed are configurable via props. Works as a hero section background, card fill, or full-page backdrop. Because the animation runs with CSS rather than JavaScript, it has no performance impact on React render cycles or scroll event handling.

Good for

  • Hero section animated backgrounds
  • Card and panel background fills
  • Section backdrop color effects
  • Promotional and campaign page backgrounds

Guides