Skip to Content

Contour Field

Topographic contour map background painted on canvas from a seeded string: a blurred generative field traced with white contour lines from its own luminance, in several palettes. Fills a positioned parent and repaints on resize.

Installation

pnpm dlx shadcn@latest add @01orbital/contour-field

Usage

import { ContourField } from "@/components/celestograph/contour-field"

export default function Demo() {
  return (
    <div className="relative aspect-video w-full max-w-2xl overflow-hidden rounded-2xl">
      <ContourField from="enceladus" palette="delft" />
    </div>
  )
}

This example installs with everything it uses:

pnpm dlx shadcn@latest add @01orbital/contour-field-demo

Examples

Tarn Atlascontour-field-tarn-atlas

Example of the Contour Field: a tarn atlas topographic map with fourteen contour levels and a dark inset caption. The contour field is a topographic generative art background for cards and heroes.

pnpm dlx shadcn@latest add @01orbital/contour-field-tarn-atlas

API reference

A blurred painted field with white contour lines traced over it, filling its nearest positioned ancestor, used as a background for cards, panels and pages. The same from string always paints the same field.

Hidden from assistive tech. The palette's lower color shows until the field paints, then it fades in over 500ms, or at once with reduced motion. The field and lines are drawn 1.3 times the box size, so their edges fall outside it and are cropped.

Prop

Type

It also accepts the HTML attributes of the element it renders.

Dependencies

npm: @base-ui/react, cn. The CLI installs them for you.

Used in blocks

2 blocks are built with Contour Field:

Last updated on