Skip to content
← Components

Aurora Background

Aurora Background adds a distinctive visual surface to your composition.

Open ↗

Make it yours.

Install the editable source and its dependencies into your React + Tailwind project.

Scroll horizontally for long lines
pnpm dlx shadcn@4.0.8 add http://localhost:3000/r/aurora-background.json

Use it

Scroll horizontally for long lines
"use client";
import { AuroraBackground } from "@/components/jez-ui/ui/aurora-background";

export default function Example() {
  return (
    <>
      <AuroraBackground className="min-h-[360px]">
        <div className="flex min-h-64 flex-col justify-between">
          <h3 className="max-w-md font-display text-5xl font-medium leading-[1.03] tracking-tight md:text-6xl">
            After hours.
          </h3>
          <p className="mt-8 text-sm">A little light in the dark.</p>
        </div>
      </AuroraBackground>
    </>
  );
}

Props & types

Scroll horizontally for long lines
Omit<
  React.ComponentProps<"div">,
  keyof {
    children?: React.ReactNode;
    className?: string;
    paused?: boolean;
    colors?: [string, string];
    duration?: number;
  }
> & {
  children?: React.ReactNode;
  className?: string;
  paused?: boolean;
  colors?: [string, string];
  duration?: number;
}

Source

View 2 source files

registry/ui/aurora-background.tsx

Scroll horizontally for long lines
"use client";
import * as React from "react";
import { cn } from "./utils";
export function AuroraBackground({
  children,
  className,
  paused = false,
  colors = ["#3366cb", "#80e7b4"],
  duration = 12,
  ...rootProps
}: Omit<
  React.ComponentProps<"div">,
  keyof {
    children?: React.ReactNode;
    className?: string;
    paused?: boolean;
    colors?: [string, string];
    duration?: number;
  }
> & {
  children?: React.ReactNode;
  className?: string;
  paused?: boolean;
  colors?: [string, string];
  duration?: number;
}) {
  return (
    <div
      {...rootProps}
      className={cn(
        "relative min-h-64 overflow-hidden rounded-xl bg-[#131d2c] text-white",
        className,
      )}
    >
      <div
        aria-hidden="true"
        className="absolute -inset-20 opacity-60 blur-3xl"
        style={{
          background: `conic-gradient(from 90deg,transparent,${colors[0]},transparent,${colors[1]},transparent)`,
          animation: `jez-aurora ${duration}s ease-in-out infinite`,
          animationPlayState: paused ? "paused" : "running",
        }}
      />
      <div className="relative p-8">{children}</div>
    </div>
  );
}

registry/ui/utils.ts

Scroll horizontally for long lines
import { clsx, type ClassValue } from "clsx";
import { twMerge } from "tailwind-merge";
export function cn(...values: ClassValue[]) {
  return twMerge(clsx(values));
}

Dependencies

clsx@2.1.1 · tailwind-merge@3.5.0

Accessibility & behaviour

Respect reduced-motion preferences. Decorative effects must not carry essential information. WebGL scenes include a static fallback and only render while visible.

Read the accessibility and performance guide →