Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Backgrounds

Pro

Corona Background for React

A sunrise from the top of the box: a giant sun mostly above the edge pours soft rays and a warm haze down into a sky that cools away from it. For React with Base UI, when a launch page or a calm, atmospheric hero needs warm light behind its copy.

Framework

A sunrise from the top of the box: a giant sun sits mostly above the edge, only its glowing limb showing, and pours soft rays and a warm haze down into a sky that cools away from it, with faint coronal loops shimmering along the limb. Two layers of seeded rays sway slowly out of step, so the light keeps shifting like beams through haze. The sun, haze and loops are CSS gradients painted once; the rays move with transforms and blend onto the sky, so the browser repaints nothing. On a dark page it's amber light over deep navy; on a light page, cream and gold on paper.

It suits launch pages and calm, atmospheric heroes, with the copy in the middle or lower down. For a dark moon framed by its corona, use Eclipse; for the glowing remnant of an exploded star, Supernova; for light under water, Underwater; for light split into a fan, Prism.

Preview width

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 className="flex min-h-[420px] flex-col items-center justify-center">
  <h1 className="text-4xl font-semibold">Launch day is almost here</h1>
</Corona>

Corona is a container: what you put inside renders on top, in normal flow. The sun's radius is 42% of the container's width, and its centre sits above the box, a little past the middle on the end side, so only a sliver of its limb shows at the top and the rays reach every corner. It paints its own sky: your background with a warm wash in light mode, deep navy in dark mode. For a backdrop behind the whole page, render it empty with className="fixed inset-0 -z-10".

Demos

Red giant

colors takes up to three CSS colours: the sun and its rim, the haze, and the rays. Here a peach sun with deep red haze and coral rays; the container's dark class keeps the night sky in both colour schemes.

Preview width

In a card

intensity="subtle" softens the rays and the haze, and stars={false} leaves out the stars. The sun scales with the box, so the light works at card size too.

Preview width

Accessibility

The sun is decorative: it's hidden from screen readers and never takes the pointer, and your content stays on top in normal flow. With reduced motion the rays stop swaying and the loops stop shimmering, so a still sunrise stays. Nothing flashes; the loops fade in and out over eight seconds or more.

Put copy in your foreground colour (text-foreground) in the middle or lower half of the box: the rays fade with distance from the sun, so there it reads in both colour schemes. The limb and the haze right under it are the brightest part, so keep text off the top edge.

FAQ

Where does the sun sit?

Above the top edge: its radius is 42% of the container's width (30% of its height in a tall box), its centre 58% across, and only the bottom 7% of the box's height of it shows. On a right-to-left page it moves to the same place from the other side.

How do I recolour it?

Pass up to three colors: the sun and its rim, the haze, and the rays, as any CSS colours; fewer are repeated. You can also set --corona-color-1 to --corona-color-3 in your CSS.

Can I slow it down?

speed scales the rays' 29 and 37 second sways and the loops' shimmer together, so they stay in proportion: 0.5 is half as fast.

Will it slow my page down?

No. The two ray layers turn a few degrees with rotate and fade with opacity, which the browser composites without repainting; everything else is painted once. There's no canvas and no script.

Are the rays random?

They're seeded: each ray's strength comes from its index, so the same fan is drawn on every render, on the server too, and the rays are strongest straight down, fading toward the sides.

Does it respect reduced motion?

Yes: one still frame of the sunrise, with no swaying or shimmering.

API Reference

Corona

<div> data-slot="corona"

PropType
colors?string[]

Up to three CSS colours: the sun and its rim, the haze, and the rays, repeated when there are fewer. By default cream, amber and gold.

intensity?"subtle" | "medium" | "strong"

How strongly the rays and the haze show. @default "medium".

Type
"subtle" | "medium" | "strong"
speed?number

How fast the rays sway and the loops shimmer, as a multiplier: 2 is twice as fast.

Default
1
stars?boolean

Whether faint stars show low in the sky, in dark mode only. @default true.

Default
true
render?ReactElement | ((props: object, state: object) => ReactElement)

Replace the host element or compose it with another component.

Type
ReactElement | ((props: object, state: object) => ReactElement)
className?string

Merged with the part's classes.

CSS variableType
--corona-anglestring
--corona-color-1string

The sun and its rim (cream).

--corona-color-2string

The haze (amber).

--corona-color-3string

The rays (gold).

--corona-cystring
--corona-hstring
--corona-rstring
--corona-reachstring
--corona-speedstring

How fast the rays sway, a multiplier (1).

--corona-topstring
--corona-wstring
--corona-xstring
--corona-ystring
All 100 backgrounds