Backgrounds

Circuit

A circuit board that draws itself. Chips are placed first, then every pin grows a trace across a grid, with 45 degree bends and a via at the end. The gaps fill with loose traces. Pulses of light run along the copper, and a pulse that reaches a chip can leave again from another pin. Move the pointer and the copper near it lights up and sends out pulses of its own.

Install

# Circuit needs no npm packages

Then copy 2 files into your project:

  • components/registry/circuit/circuit.tsx
  • hooks/use-animation-loop.ts

Props

PropTypeDefaultDescription
cellSizenumber22Size of one grid cell. Small cells give a finer and busier board. A new size draws a new board.
densitynumber0.7How much of the board is filled with chips and traces.
pulseRatenumber1How often a new pulse starts. 0 leaves the board dark.
speednumber1How fast the pulses travel.
trailnumber70Length of the tail behind each pulse.
glownumber1How strong the glow around the light is. 0 leaves a thin line.
interactivebooleantrueThe pointer lights the copper near it and starts pulses there.
traceColorstring (hex)"#2b2440"The copper at rest.
pulseColorstring (hex)"#b57bff"The light that runs along the copper.
boardColorstring (hex)"#0a0810"The board under the copper.

What It Demonstrates

Loop
An animation that repeats, a set number of times or infinitely.
Idle animation
Subtle motion that plays while an element is just sitting there, waiting to be interacted with.
Line drawing
An SVG path that draws itself in, like an invisible pen tracing it.
Pulse
A gentle repeating scale or opacity change to draw attention.
Hover effect
Visual change when the cursor moves over an element.

Related Components

Appears In