Spectrum Bars

Customize

Theme
0.86
1.00
112
2.0
0.5
3.6

Installation

Installs are paused for now. You can still preview and customize every component on its page.

Usage

import { SpectrumBars } from "@/components/spectrum-bars";

<div className="relative h-96 overflow-hidden rounded-2xl">
  <SpectrumBars />
  <div className="relative">Your content</div>
</div>

A signal background of bright vertical color stripes that fill the whole block, like a TV test pattern. The stripes slowly slide sideways while their colors drift and blend into each other, some dim down between them and the brightest ones glow toward white. Everything moves smoothly, with no jumps.

It fills its parent, so give the parent position: relative and a size, and put your content after it. It ignores the mouse, so clicks go through to your content.

Pick colors with theme: "signal" (green, cyan, blue, pink, red, orange and yellow, the default), "neon", "sunset" or "mono". Or pass your own list:

<SpectrumBars colors={["#00a3ff", "#7df9ff", "#ff2d75", "#ffb3d1"]} />

By default the stripes fill the full height and most of the width (bandWidth 0.86), so their left and right ends fade softly into the background. Set bandWidth to 1 to fill the whole block, or make bandWidth and bandHeight smaller (from 0 to 1) to shrink them into a band in the middle. columns sets how many stripes fit across, glow how much soft light spreads from them (0 turns it off), glitch how far everything sways sideways, smoothly, and speed how fast they slide and change; it goes up to 10 in the playground and has no upper limit.

It's drawn on a canvas and pauses when it's off screen or the tab is hidden. The stripe colors are its own and stay the same in light and dark mode. The dimmed stripes fade into your theme's background color, so it blends with the page. Pass backgroundColor to use another color behind them. When reduced motion is on, or animate is false, it draws one still frame.

Props

PropType

The color theme.

Default"signal"

Your own colors. Overrides theme.

How wide the stripes are, as a share of the area. 1 fills it.

Default0.86

How tall the stripes are, as a share of the area. 1 fills it.

Default1

How many stripes fit across, from 4 to 256.

Default112

How much soft light spreads from the stripes. 0 turns it off.

Default2

How far the stripes sway sideways. 0 turns it off.

Default0.5

How fast the stripes slide and change color.

Default3.6

Set to false to show one still frame.

Defaulttrue

The color the dimmed stripes fade into. Defaults to your theme background.

Rounds the corners, e.g. "1rem".