# Topo Background

A living contour map that drifts, rises under the cursor and ripples on click, built with React and Canvas.

## Installation

Topo Background is a free, open-source React component in the Kokonut UI [Backgrounds collection](/content/docs/backgrounds/index.html). Add it with the shadcn CLI, which copies the source into `components/kokonutui/topo-background.tsx`, so the code is yours to change.

```
npx shadcn@latest add @kokonutui/topo-background
```

## Usage

```
import TopoBackground from "@/components/kokonutui/topo-background";

export default function Example() {
  return <TopoBackground />;
}
```

## Props

- `className`  
  `string`  
   Extra classes for the root. The map draws on a transparent canvas, so `className="bg-transparent"` lays it over your own page background.

- `children`  
  `ReactNode`  
   Content shown over the map. Pass `null` for a bare background.

- `interval`  
  `number` Default `0.07`  
   Height difference between two contour lines. Lower draws more lines.

- `speed`  
  `number` Default `1`  
   How fast the terrain drifts. 0 holds it still.

- `interactive`  
  `boolean` Default `true`  
   Raise a hill under the cursor and send a ripple on click.

- `seed`  
  `number` Default `26`  
   Seed for the terrain, so a page always opens on the same map.

- `labels`  
  `boolean` Default `true`  
   Print elevations on the index contours, as on a survey map.

## Dependencies

| Needs | Version | Comes from |
| --- | --- | --- |
| `cn` from `lib/utils.ts` |  | shadcn init |
| React | `19` | Your app |
| Tailwind CSS | `4` | Your app |

No provider, font or global CSS to set up: the file works as soon as it lands.

[Wind\](/content/docs/backgrounds/flow-field/index.html)\
\
Streamlines that part around the cursor, swirl in its wake and scatter on click, built with React and Canvas.

[Drape Background\](/content/docs/backgrounds/drape-background/index.html)\
\
A pleated curtain in a breeze that you can push and pull, built with React, WebGL and a cloth simulation.
