# Contour Lines

> Topographic contour lines drifting over a slowly changing field.

Source: https://www.honestui.com/docs/shaders/contour-lines

<ComponentPreview name="contour-lines-demo" />

## Overview [#overview]

Contour Lines draws the level lines of a slowly shifting terrain, like a topographic map. Every `majorEvery`th line is an index contour, drawn thicker and brighter. The hills reshape gently over time rather than sliding across the surface.

The background is transparent and the lines use `currentColor` at low opacity by default, so the effect follows the text color in light and dark themes. Use it behind a section heading, an empty state, or a data product's landing page.

## Installation [#installation]

<CommandBlock commands="[&#x22;honestui&#x22;]" />

## Usage [#usage]

```tsx
import { ContourLines } from "honestui/shaders"

<div className="relative h-96 bg-background text-foreground">
  <ContourLines className="absolute inset-0" fade="radial" />
  <div className="relative grid h-full place-items-center">
    <h2 className="text-3xl font-medium">Know the terrain.</h2>
  </div>
</div>
```

Lines are antialiased at their CSS width on any screen density. Lower `levels` or raise `scale` for a calmer map, and use `fade` to keep the lines away from the edges.

## Accessibility [#accessibility]

Contour Lines is decorative and its canvas is hidden from assistive technology. Keep text and actions in normal HTML; at the default opacity the lines stay well below body text in contrast.

The effect pauses while it is offscreen or the tab is hidden, and shows a still frame when the user prefers reduced motion. Without WebGL the container shows only its own background.

## API Reference [#api-reference]


  ### `color`

type: `string` · default: `&#x22;currentColor&#x22;`

Line color. Any CSS color; 

    `currentColor`

     follows the text color and theme.

  ### `opacity`

type: `number` · default: `0.35`

Line opacity, from 0 to 1.

  ### `lineWidth`

type: `number` · default: `1`

Line width in CSS pixels.

  ### `levels`

type: `number` · default: `14`

Number of contour levels across the field.

  ### `majorEvery`

type: `number` · default: `5`

Draw every Nth line thicker and brighter. 0 turns index contours off.

  ### `scale`

type: `number` · default: `1`

Size of the terrain. Larger values draw more, smaller hills.

  ### `fade`

type: `&#x22;none&#x22; | &#x22;radial&#x22; | &#x22;edges&#x22; | &#x22;top&#x22; | &#x22;bottom&#x22;` · default: `&#x22;none&#x22;`

Fade the lines out toward the edges.

  ### `speed`

type: `number` · default: `1`

Animation speed. 0 holds the terrain still.

  ### `paused`

type: `boolean` · default: `false`

Renders a still frame instead of animating.

  ### `className`

type: `string`

Class for sizing and positioning the container.

  ### `children`

type: `ReactNode`

Content rendered above the lines.
