Skip to content

shadcn.io is an independent project built on shadcn/ui

Free

Aurora Background for Svelte

Curtains of northern lights with rays, folds and your own colors. For Svelte with Ark UI, when a hero needs color and slow motion.

On this page10 sections
UI library: Ark UI

Curtains of light hang across the box like the northern lights: each one's lower edge waves on slow noise, fine vertical rays gather in its folds, and the color runs from the edge to the tips through a palette you choose. It's a GLSL scene on WebGL2 with no dependency. The scene is transparent and reads the surface behind it, so it glows on a dark page and tints a light one, and the curtains lean a little toward the pointer.

Use it behind a hero, a sign-up section or a launch card. For calm blobs of color instead of curtains, use Mesh Gradient; for one soft light behind a headline, Glow; for a night sky to pair it with, Starfield. With reduced motion it holds one still frame.

Playground
Aurora Background, still
Customize

Installation

Sign in to get your install command
Free with an account. It carries your token, so the CLI installs everything in one go.

Usage

<script lang="ts">
import { Aurora } from "@/components/ui/aurora";
</script>
<Aurora class="flex min-h-[32rem] flex-col items-center justify-end pb-16">
  <h1 class="text-5xl font-semibold">Deploys that finish first</h1>
</Aurora>

Aurora is a container: whatever you put inside sits on top of the light, in normal flow. It fills its own box, so give it a height or content. For a backdrop behind the whole page, render it empty with className="fixed inset-0 -z-10".

Presets

Borealisthe default lookTry it
<Aurora />
ArcticTry it
<Aurora
  amplitude={0.6}
  colors={["#8fe3ff", "#e8f6ff", "#6f9bff"]}
  rays={0.4}
  speed={0.6}
/>
DuskTry it
<Aurora
  amplitude={1.5}
  colors={["#ffb35c", "#ff5c8a", "#8a5cff"]}
  layers={3}
  rays={1}
/>
EmberTry it
<Aurora
  colors={["#ffd166", "#ff7a3d", "#d7263d"]}
  height={0.12}
  placement="bottom"
  reach={0.7}
/>
MonoTry it
<Aurora
  colors={["var(--foreground)", "var(--muted-foreground)"]}
  intensity={0.7}
/>
VeilTry it
<Aurora
  colors={["#7cff67", "#22d3c5", "#8f5cff"]}
  intensity={0.8}
  layers={3}
  rays={0.2}
  reach={0.8}
  scale={0.6}
/>

Each preset is a set of props, so copy one and keep tuning. Borealis is the default, Dusk warms it for a dark page, Ember lifts the light from the bottom edge for a footer or a pricing band, and Mono takes its two colors from your theme.

Examples

Hero

The light fills the top of the box and thins out toward its lower edge, so the copy sits at the bottom, where the surface is plain. The headline and the line under it use the foreground color; the chip and the second button have a translucent ground of their own.

Preview width

Colors

colors runs from the lower edge of the curtains to their tips: here ember, rose and violet on a dark surface, with layers={3}, taller folds (amplitude={1.5}) and the rays at full strength.

Preview width

In a card

placement="bottom" turns it over, so the light falls from the top of the card, and height and reach set where it starts and how far it gets. grain adds film grain over it.

Preview width

Customization

Every color is a CSS color, so a theme variable works and follows a theme switch: colors={["var(--chart-1)", "var(--chart-2)"]}. The palette is mixed in OKLab, so two distant hues meet in a clean color, not a grey one.

The surface is the root's own background, bg-background by default. Give the root another (bg-slate-950, an image, a gradient) and the light adapts: it adds to a dark surface and tints a light one. fade masks an edge, opacity turns the whole effect down, and grain adds film grain.

<Aurora
  class="min-h-[32rem] bg-slate-950"
  colors={["var(--chart-2)", "var(--chart-4)", "var(--chart-1)"]}
  fade="bottom"
  grain={0.2}
/>

Performance

It's one WebGL2 canvas and one fragment shader: five samples of simplex noise a curtain, three curtains at most, and no loops beyond that. It draws only while it's on screen and the tab is visible, shares one frame loop with every other background on the page, and lowers its own resolution if frames run long. quality sets the render scale yourself, and paused holds the frame.

Accessibility

The light is decoration: it's hidden from assistive tech and lets every click through to your content. With reduced motion it draws one still frame and ignores the pointer. Nothing flashes.

Put copy where the light is thin, or use the foreground color (text-foreground) for every line on top of it. On a light surface the light is a pale tint and dark text stays easy to read anywhere. On a dark surface the brightest fold is bright enough to wash out small text, so keep body copy off it, or lower intensity.

FAQ

How do I change the colors?

Pass two to eight CSS colors to colors. The first is the lower edge of the curtains and the last is their tips, with the rest spread between. Hex, oklch() and theme variables such as var(--primary) all work, and a variable follows your theme when it changes.

Does it work on a light page?

Yes, with no prop to set. The scene reads the color behind it: on a dark surface the curtains add light, and on a light one they tint it, so the same palette reads as a soft wash on white. Set the surface with a class on the component, such as bg-slate-950.

How do I put it behind the whole page?

Render it empty with className="fixed inset-0 -z-10". It still follows the pointer there, since it listens on the window. To put it behind one section, wrap that section's content in it and give it a height, such as min-h-svh.

Will it slow my page down?

It's a light shader: a handful of noise samples a pixel, on the GPU, and nothing at all while it's off screen or the tab is hidden. If a device can't keep up, it renders fewer pixels by itself. For a phone-first page, quality={0.75} draws a little over half the pixels and is hard to tell apart.

Does it work with Next.js and server components?

Yes. Import it into a server component and it renders its box and your content on the server; the canvas starts in the browser and fades in over the surface. It needs WebGL2, which every current browser has. Without it the box keeps its background, or the fallback you pass.

Can I turn off the pointer effect?

Yes: interactive={false}. By default the curtains lean a little toward the pointer, more at their tips. Touch never moves them, so scrolling on a phone isn't disturbed.

Can the light come from the bottom?

placement="bottom" turns the scene over. With height near 0 and a long reach, the light fills the box from one edge and fades toward the other, which suits a footer or the top of a card.

What happens with reduced motion?

It draws one still frame of the curtains and stops, and the pointer no longer moves them. The frame is the same one every time, so the page looks the same on each visit.

API Reference

Aurora

data-slot="aurora"

PropType
amplitude?number

How far the lower edge of the curtains waves up and down.

Default
1
colors?string[]

Two to eight CSS colors, from the lower edge of the curtains to their tips. Theme variables such as var(--primary) follow your theme.

Default
["#22e584", "#19d3c5", "#4f7dff", "#a05cff"]
fade?"none" | "radial" | "top" | "bottom" | "left" | "right"

Which edges fade out to the surface: radial keeps the middle, the others name the side that fades.

Type
"none" | "radial" | "top" | "bottom" | "left" | "right"
Default
"none"
fallback?string

What shows until the first frame and in browsers without WebGL2: a CSS background value that looks like the scene.

grain?number

Film grain over the scene, from 0 to 1.

Default
0
height?number

Where the lower edge sits, from 0 (the bottom of the box) to 1 (the top).

Default
0.42
intensity?number

How bright the light is.

Default
1
interactive?boolean

Whether the scene follows the pointer and answers a press. Touch never moves it, so scrolling a page on a phone isn't disturbed.

Default
true
layers?number

How many curtains hang one behind the other, from 1 to 3.

Default
2
opacity?number

How strongly the scene shows over the surface, from 0 to 1.

Default
1
paused?boolean

Holds the current frame.

Default
false
placement?"top" | "bottom"

Which side the light fills: top hangs it from above, bottom raises it from below.

Type
"top" | "bottom"
Default
"top"
quality?number

Render scale, from 0.25 to 1, of the screen's pixels (capped at 2×). Lower is cheaper and softer.

Default
1
rays?number

How strongly the fine vertical rays show in the curtains, from 0 to 1.

Default
0.7
reach?number

How far the light reaches past the lower edge, as a share of the box.

Default
0.5
scale?number

The size of the folds: higher packs more of them across the box.

Default
1
speed?number

Animation speed: 1 is normal, 0 holds the frame.

Default
1
time?number

A fixed moment, in seconds: draws it and doesn't animate.