Dot Canvas
A decorative dotted canvas overlay for design surfaces and page backgrounds.
Loading preview…
1<script lang="ts">
2 import DotCanvas from "./dot-canvas.svelte";
3</script>
4
5<div class="relative h-40 w-full max-w-md overflow-hidden rounded-xl border">
6 <DotCanvas />
7 <p class="relative z-10 p-6 text-sm text-muted-foreground">Content sits above the dots.</p>
8</div>
9Installation
1. Install dependencies
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%)]" />