Dot Canvas

A decorative dotted canvas overlay for design surfaces and page backgrounds.

Loading preview…

Installation

Usage

Place DotCanvas inside a relative container. It fills the parent with a dotted grid and ignores pointer events, so content above stays interactive. The overlay is decorative and hidden from assistive technology.

1<script lang="ts">
2  import { DotCanvas } from '~/lib/dot-canvas';
3</script>
4
5<div class="relative h-48 overflow-hidden rounded-xl border">
6  <DotCanvas />
7  <p class="relative z-10 p-6 text-sm">Content sits above the dots.</p>
8</div>

Pass size as 12, 20, or 24 (default) to change grid pitch. Use class for opacity, masks, or placement overrides.

1<DotCanvas size={12} class="mask-[radial-gradient(ellipse_at_center,transparent_20%,black_85%)]" />