shadcn.io is an independent project built on shadcn/ui
Hexagon Background for Solid
A honeycomb of outlined hexagons where cells light up in slow breaths. For Solid with Ark UI, when a hero needs structure that glows.
On this page10 sections
A honeycomb of outlined hexagons fills the box. A share of the cells light up and fade in slow breaths, gathered in patches that drift across, and each lit cell glows from its outline inward. It's a GLSL scene on WebGL2 with no dependency: the cells are exact hexagons placed on whole pixels, so the outlines keep an even width and don't shimmer. The scene is transparent and reads the surface behind it, so the light glows on a dark page and tints a light one. The cells near the pointer light up, and a press sends a ring through them.
Use it behind a hero, a feature section or a status card, where a page wants structure with a little life in it. For a square grid drawn in CSS, use Grid Pattern; for an isometric field of tiles that lift, Boxes; for a lattice of small squares that flicker, Flickering Grid. With reduced motion it holds one still frame.


Installation
Usage
import { Hexagon } from "@/components/ui/hexagon";<Hexagon
class="flex min-h-[32rem] flex-col items-center justify-end pb-16"
fade="bottom"
>
<h1 class="text-5xl font-semibold">Scale out one cell at a time</h1>
</Hexagon>Hexagon is a container: whatever you put inside sits on top of the honeycomb, 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
<Hexagon /><Hexagon
gap={10}
glowColor="#8b5cf6"
lit={0.3}
rounding={0.4}
size={96}
speed={0.7}
wave={1}
/><Hexagon
fill={1}
gap={8}
glowColor="#ec4899"
lineWidth={2}
rounding={1}
size={40}
/><Hexagon
fill={1}
gap={2}
glowColor="#ef4444"
lit={0.06}
size={20}
wave={1}
/><Hexagon
angle={30}
gap={0}
glowColor="#22d3ee"
lit={0.2}
rounding={0}
size={40}
/><Hexagon fill={0.35} glowColor="var(--foreground)" lit={0.1} /><Hexagon fill={0} gap={6} glowColor="#10b981" lit={0.25} />Each preset is a set of props, so copy one and keep tuning. Honey is the default. Mesh closes the gap so the cells share their sides, lays them flat and lights them in cyan; Bubbles rounds every cell into a ring; Mono takes both colors from your theme; and Outline lights the outlines alone, with no fill.
Examples
Hero
fade="bottom" thins the honeycomb out toward the lower edge, and the copy sits there, where the surface is plain. Everything else is the default: amber light on outlines in the foreground color. The chip and the second button have a translucent ground of their own.
Mesh
gap={0} joins the cells into one mesh with shared sides, rounding={0} keeps the corners sharp and angle={30} lays the hexagons on a side. The surface is the root's own class (bg-slate-950), with a slate color for the outlines and a cyan glowColor.
In a card
Smaller cells (size={30}, gap={3}) with a violet light in a max-w-sm card. fade="bottom" clears the cells from under the copy, and lit={0.2} lights one cell in five.
Customization
Both colors are CSS colors, so a theme variable works and follows a theme switch. color is the outlines, var(--foreground) by default and drawn faint, and glowColor is the lit cells and the pointer's light. size, gap and lineWidth are in pixels; rounding turns the corners from sharp to nearly round, and fill sets how much of a lit cell fills with light.
The surface is the root's own background, bg-background by default. Give the root another (bg-slate-950, a gradient) and the light adapts: it adds to a dark surface and tints a light one. The outline color doesn't adapt by itself, so on a fixed dark surface pass a color that reads on it. fade masks an edge, opacity turns the whole scene down, and grain adds film grain.
<Hexagon
class="min-h-[32rem]"
fade="radial"
glowColor="var(--chart-2)"
lit={0.25}
rounding={0.5}
size={64}
/>Performance
It's one WebGL2 canvas and one fragment shader with no loops beyond the four presses it remembers: for each pixel it finds its cell and the one across the nearest side, and reads each one's light from two hashes and one sample of simplex noise. 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 honeycomb 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: a cell takes between three and seven seconds to reach its full light and as long to fade.
Put copy where the cells are faded out, or use the foreground color (text-foreground) for every line on top. With the defaults, text in the foreground color over the brightest part of a fully lit cell measures 15.0:1 on a light surface and 9.1:1 on a dark one, and 6.5:1 at 80% opacity on dark. A brighter glowColor or fill={1} lowers that on a dark surface, so check it again, or lower intensity.
FAQ
How do I change the colors?
color sets the outlines and glowColor sets the lit cells and the light under the pointer. Both take any CSS color: hex, oklch() or a theme variable such as var(--primary), which follows your theme when it changes. For a one-color look, set glowColor="var(--foreground)", as the Mono preset does.
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 lit cells add light, and on a light one they tint it, so the same amber reads as a soft honey wash on white. The outlines use your theme's foreground color, drawn faint, so they follow the theme too.
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 few hashes and two 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.
What do the pointer and a click do?
The cells within radius pixels of the pointer light up, brightest under it, and a press sends a ring of light out through the cells. Touch never moves the light, so scrolling on a phone isn't disturbed, and a press on a link or a button over the honeycomb doesn't start a ring. interactive={false} turns both off.
How do I get flat-top hexagons or a closed mesh?
angle={30} lays the hexagons on a side; at 0 they stand on a point, and any angle in between turns the whole honeycomb. gap={0} closes the space between cells, so neighbours share one line and a lit cell lights its shared sides. Add rounding={0} for sharp corners.
API Reference
Hexagon
data-slot="hexagon"
angle?number
Turns the honeycomb, in degrees: 0 stands the hexagons on a point, 30 lays them on a side.
- Default
0
color?string
The outlines' color, any CSS color. A theme variable such as
var(--foreground) follows your theme.
- Default
"var(--foreground)"
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.
fill?number
How much a lit hexagon fills with light, from 0 (its outline only) to 1.
- Default
0.6
gap?number
The space between two hexagons, in pixels. At 0 they share their sides as one mesh.
- Default
4
glowColor?string
The color of the lit hexagons and of the light under the pointer, any CSS color.
- Default
"#f59e0b"
grain?number
Film grain over the scene, from 0 to 1.
- Default
0
intensity?number
How strongly the outlines and the light show.
- 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
lineWidth?number
The outlines' width, in pixels.
- Default
1
lit?number
The share of hexagons that are lit at a time, from 0 to 1. Each one fades in and out slowly.
- Default
0.14
opacity?number
How strongly the scene shows over the surface, from 0 to 1.
- Default
1
paused?boolean
Holds the current frame.
- Default
false
quality?number
Render scale, from 0.25 to 1, of the screen's pixels (capped at 2×). Lower is cheaper and softer.
- Default
1
radius?number
How far the light under the pointer reaches, in pixels.
- Default
160
rounding?number
How round the corners are, from 0 (a sharp hexagon) to 1 (nearly a circle).
- Default
0.15
seed?number
Another layout of the lit hexagons, a whole number.
- Default
0
size?number
The width of one hexagon from side to side, in pixels.
- Default
52
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.
wave?number
How much the lit hexagons gather into slow drifting patches, from 0 (evenly scattered) to 1.
- Default
0.7











