Skip to content

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

Pro

Corona Background for Solid

Shafts of light fan down from the top edge through mist and drifting dust. For Solid with Ark UI, when a hero needs sunlight behind its copy.

On this page10 sections
UI library: Ark UI

Shafts of light fan down from a bright source just above the top edge, the way sun comes through a gap in cloud. It's a GLSL scene on WebGL2 with no dependency: the shafts are noise along the angle around the source, in two layers, so they differ in width and each one brightens and dims by itself. Mist drifts across them and specks of dust show where the light falls. On a dark surface the light adds to it; on a light one the shafts become a soft tint of the color. The fan leans toward the pointer and a press sends a swell down the shafts.

Use it behind a hero, a launch page or the top of a long page, with the copy in the lower half. For one bar of light and a single cone, use Lamp; for cones that sweep and aim at the pointer, Spotlight; for a dark disc with a bright rim, Eclipse. With reduced motion it holds one still frame.

Playground
Corona Background, still
Customize

Installation

Part of Pro
Pro unlocks the code and one-line install of every Pro button and text effect, plus the MCP for your AI editor.
Have Pro already? Sign in to open it.Opens here as soon as you're Pro.

Usage

import { Corona } from "@/components/ui/corona";
<Corona class="flex min-h-[34rem] flex-col items-center justify-end pb-16">
  <h1 class="text-5xl font-semibold">Mornings that plan themselves</h1>
</Corona>

Corona 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

Sunlightthe default lookTry it
<Corona />
BladesTry it
<Corona
  bloom={0.4}
  colors={["var(--foreground)", "var(--muted-foreground)"]}
  dust={0}
  haze={0}
  rays={40}
  softness={0}
/>
CathedralTry it
<Corona
  colors={["#ffffff", "#dbe7ff", "#8ea6ff"]}
  dust={0.6}
  haze={0.8}
  length={1.6}
  rays={8}
  softness={0.25}
  spread={0.3}
/>
DawnTry it
<Corona
  bloom={1.3}
  colors={["#fff0f6", "#ff9ecf", "#9b6bff"]}
  dust={0}
  haze={1}
  length={1.3}
  rays={9}
  softness={0.9}
  spread={0.9}
/>
DeepTry it
<Corona
  colors={["#d9fff6", "#4fd1c5", "#2563eb"]}
  dust={0.2}
  haze={0.9}
  rays={22}
  shimmer={1}
  softness={0.8}
  spread={0.8}
/>
EmberTry it
<Corona
  angle={-24}
  colors={["#ffe3b0", "#ff7a3d", "#d7263d"]}
  position={0.88}
  rays={10}
  softness={0.35}
/>
Windowthe default lookTry it
<Corona
  angle={32}
  dust={0.8}
  haze={0.6}
  length={1.5}
  position={0.06}
  rays={9}
  softness={0.3}
  spread={0.35}
/>

Each preset is a set of props, so copy one and keep tuning. Sunlight is the default. Window moves the source to the top left corner and tilts a narrow bundle across the box, Cathedral drops a few long white shafts straight down, and Deep spreads many soft teal ones, like light under water. Blades takes its colors from your theme and draws about 40 hard-edged shafts with no mist.

Examples

Hero

The source is at the top center and the light thins quickly, so the copy sits in the lower half of the box, where the shafts are faint. It uses no props.

Preview width

Window

position={0.06} puts the source near the top left corner and angle={32} points the fan down and to the right. With spread={0.35} and rays={9} it's a narrow bundle of clear shafts, and dust={0.8} fills them with specks. The copy sits in the far corner.

Preview width

In a card

A cool palette, from white through ice blue to periwinkle, with a narrow fan (spread={0.3}) of eight shafts and a shorter length, so the text at the bottom of the card sits on a plain surface.

Preview width

Customization

colors takes two to four CSS colors, from the source to the far end of the shafts, mixed in OKLab; the bright core of each shaft takes the earlier colors and its dim edges the later ones. A theme variable works and follows a theme switch. position and angle place the source and aim the fan, spread and rays set how wide it opens and how many shafts it holds, and softness, haze and dust set the air they pass through.

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, where a pale color is deepened so it still shows. fade masks an edge, opacity turns the whole effect down, and grain adds film grain.

<Corona
  angle={-20}
  class="min-h-[32rem] bg-slate-950"
  colors={["var(--chart-1)", "var(--chart-2)", "var(--chart-3)"]}
  fade="bottom"
  position={0.8}
/>

Performance

It's one WebGL2 canvas and one fragment shader: ten samples of simplex noise a pixel (three for each layer of shafts, one for the shimmer, three for the mist), two hashed cells for the dust, and no loop beyond the four presses it remembers. 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: the shafts change over several seconds, and a press sends one soft swell of light that fades within two seconds.

Keep copy out of the top third. On a dark surface the source is nearly white, and white text reaches 4.5:1 from about 35% of the box's height below the top edge; the headline in the hero demo measures 11:1 on dark and 17:1 on light. On a light surface the shafts are a pale tint and dark text reads anywhere.

FAQ

How do I change the color of the rays?

Pass two to four CSS colors to colors. The first is the source and the bright core of each shaft, the last is the far end and the dim edges. Hex, oklch() and theme variables such as var(--primary) all work, and a variable follows your theme when it changes. Three colors close in hue, light to deep, look most like real light.

Do god rays work on a white page?

Yes, with no prop to set. Light can't be brighter than a white page, so on a light surface the shafts are drawn as a tint: the deeper colors of the palette carry it and a pale or white color is darkened a little so it doesn't vanish. On a dark surface the same palette adds light, and the source goes nearly white.

Can the light come from a corner?

position moves the source along the top edge, from 0 at the left corner to 1 at the right, and angle turns the fan, in degrees from straight down. position={0.06} with angle={32} gives light through a high window on the left; mirror both for the right.

How do I get fewer, wider shafts?

Lower rays: it's about how many shafts cross the fan, from 4 to 40. softness sets their edges, from clear blades at 0 to a wash at 1, and spread sets how wide the fan opens. seed gives another arrangement of the same look.

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 light one section, wrap that section's content in it and give it a height, such as min-h-svh.

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 the shafts grow out of the source over the surface. It needs WebGL2, which every current browser has. Without it the box keeps its background, or the fallback you pass.

Will it slow my page down?

It's a light shader: ten 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. Soft shafts hide a lower resolution well, so quality={0.75} on a phone-first page is hard to tell apart.

What happens with reduced motion?

It draws one still frame of the shafts and stops: they don't shimmer, the dust doesn't drift, the fan doesn't lean toward the pointer and a press does nothing. The frame is the same one every time, so the page looks the same on each visit.

API Reference

Corona

data-slot="corona"

PropType
angle?number

The direction the fan points, in degrees from straight down: positive leans it to the right, negative to the left.

Default
0
bloom?number

How large the glow around the source is, from 0 (none) to 2.

Default
1
colors?string[]

Two to four CSS colors, from the source to the far end of the shafts. Theme variables such as var(--primary) follow your theme.

Default
["#fff1cf", "#ffc56e", "#ff8f5e"]
dust?number

How many specks of dust drift through the shafts, from 0 (none) to 1.

Default
0.4
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
haze?number

How much mist fills the air: it lights the gaps between the shafts and drifts through them. From 0 (clear air, bare shafts) to 1.

Default
0.5
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
length?number

How far the shafts travel from the source, as a share of the box's height.

Default
1
opacity?number

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

Default
1
paused?boolean

Holds the current frame.

Default
false
position?number

Where the source sits along the top edge, from 0 (the left corner) to 1 (the right corner).

Default
0.5
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

About how many shafts fan out of the source, from 4 to 40.

Default
14
seed?number

Another arrangement of the shafts: an integer from 0 to 20.

Default
0
shimmer?number

How much each shaft brightens and dims by itself over time, from 0 (steady) to 1.

Default
0.5
softness?number

How soft the edges of the shafts are, from 0 (clear blades of light) to 1 (a wash).

Default
0.5
speed?number

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

Default
1
spread?number

How wide the fan opens, from 0 (a narrow bundle) to 1 (nearly a half circle).

Default
0.6
time?number

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