npm package
Install gridmint
Use gridmint patterns in any React or Next.js project.
Zero dependencies. Fully typed. Works with CSS, SCSS, Tailwind, and more.
Installation
npm
npm install gridmintpnpm
pnpm add gridmintyarn
yarn add gridmintbun
bun add gridmintQuick start
React componenttsx
import { GridmintPattern } from 'gridmint';
export default function Hero() {
return (
<GridmintPattern
state={{
pattern: 'dots',
bgColor: '#0a0a0a',
patColor: '#c8ff00',
size: 20,
opacity: 30,
thickness: 2,
rotation: 0,
}}
style={{ height: '100vh' }}
>
<h1>Hello World</h1>
</GridmintPattern>
);
}Hooktsx
import { useGridmintPattern } from 'gridmint';
export default function Section() {
const { style } = useGridmintPattern({
pattern: 'grid',
bgColor: '#0a0a0a',
patColor: '#ffffff',
size: 24,
opacity: 20,
thickness: 1,
rotation: 0,
});
return <div style={{ ...style, minHeight: '400px' }} />;
}CSS stringts
import { getCSS } from 'gridmint';
const css = getCSS({
pattern: 'hatch',
bgColor: '#111111',
patColor: '#ffffff',
size: 16,
opacity: 20,
thickness: 1,
rotation: 0,
});
// Inject into a stylesheet or use with CSS-in-JS
console.log(css);
// background-color: #111111;
// background-image: repeating-linear-gradient(...);
// background-size: 16px 16px;Vanilla CSScss
/* Use the generator at gridmint.ink/generate
Copy any format — CSS, SCSS, Tailwind, React, Next.js, TSX */
.hero {
background-color: #0a0a0a;
background-image: radial-gradient(
circle,
rgba(200,255,0,0.3) 1px,
transparent 1px
);
background-size: 20px 20px;
}API reference
<GridmintPattern />
React component. Renders any element with a pattern background applied as inline styles.
state PatternState — pattern configas string — HTML tag (default: div)className string — CSS classstyle CSSProperties — override styleschildren ReactNode — content insideuseGridmintPattern(state)
Hook. Returns CSS strings and a React style object for a given pattern state.
css string — full CSS stringbgCSS string — background-color onlyimgCSS string — background-image onlystyle CSSProperties — React style objectgetCSS(state)
Returns the full CSS string for a pattern state. Use with any CSS-in-JS solution or inject into a stylesheet.
PATTERNS
Array of all 12 pattern definitions. Each has
id, name, draw(), and css().PatternState
interface PatternState {
pattern: string; // 'noise' | 'dots' | 'grid' | 'rect' | 'diagonal' |
// 'hatch' | 'carbon' | 'halftone' | 'plus' | 'hex' |
// 'waves' | 'circuit'
bgColor: string; // hex color e.g. '#0a0a0a'
patColor: string; // hex color e.g. '#ffffff'
size: number; // tile size in px (4–240)
opacity: number; // 1–100
thickness: number; // stroke thickness 1–8
rotation: number; // 0–180 degrees
}