Dot pattern
Fills a section with an even field of dots, still or softly pulsing. Fade the edges and put a headline on top for a quiet hero.
How to use
- Make two files in your project's components folder: dot-pattern.tsx and dot-pattern.module.css.
- Paste the code into each one, keeping the licence note at the top of the component.
- It needs nothing beyond React. Your project needs CSS Modules, which Next.js and Vite already have.
- Import it where you want it, then change the words, colours and sizes to yours.
The code
"use client";
import { useEffect, useId, useRef, useState, type CSSProperties, type SVGProps } from "react";
import styles from "./dot-pattern.module.css";
interface DotPatternProps extends Omit<SVGProps<SVGSVGElement>, "width" | "height" | "x" | "y"> {
/** Space between dots, across. */
width?: number;
/** Space between dots, down. */
height?: number;
/** Shift the whole pattern. */
x?: number;This comes with paid plans
The code for every component comes with paid plans, along with the rest of the AI toolkit. The first component under each heading is free.