[ Effects ]

Pattern

Decorative backgrounds for heroes, cards and empty states: seven patterns (grid, dots, lines, diagonal, cross, checker, waves) with control over size, thickness, color, opacity and fade, plus effects: a slow pan, a breathing pulse, and a spotlight that lights the pattern around the cursor.

10 examplesDark modeAccessible

Import#

import { Pattern } from 'reusify-ui';

When to use#

  • Hero sections, feature cards, empty states, preview canvases and pricing tables.
  • Keep it subtle: patterns should add texture, not compete with content. Lower the opacity or use a fade.
  • Use spotlight on interactive surfaces (cards, CTAs) and pan/pulse sparingly, one animated pattern per screen.

Examples#

All patterns#

The parent must be position: relative. Content placed after the pattern sits on top.

grid
dots
lines
diagonal
cross
checker
waves
<div style={{ position: 'relative' }}>
  <Pattern variant="grid" />      {/* grid · dots · lines · diagonal · cross · checker · waves */}
  <h2 style={{ position: 'relative' }}>Ship faster</h2>
</div>

[ Controls ]

Size & thickness#

size is the tile size (px or any CSS length). thickness sets the line width, or the dot radius for dots.

size 12
size 48 · thickness 2
dots · thickness 2
<Pattern variant="grid" size={12} />
<Pattern variant="grid" size={48} thickness={2} />
<Pattern variant="dots" size={20} thickness={2} />

Color & opacity#

color takes a semantic name or any CSS color; opacity tones it down. Without color, patterns use a soft tint of the text color.

primary
#ec4899 · 0.5
success
<Pattern variant="dots" color="primary" />
<Pattern variant="diagonal" color="#ec4899" opacity={0.5} />
<Pattern variant="cross" color="success" />

Fade#

fade softens the pattern: radial (default), top, bottom, left, right, edges, or false for none.

radial
bottom
top
left
edges
false
<Pattern fade />            {/* radial */}
<Pattern fade="bottom" />
<Pattern fade="top" />
<Pattern fade="left" />
<Pattern fade="edges" />
<Pattern fade={false} />

[ Effects ]

Spotlight#

spotlight lights up the pattern around the cursor in the brand color whenever the pointer is over the parent. Tune it with spotlightColor and spotlightSize.

Hover me
Pink spotlight
<div style={{ position: 'relative' }}>
  <Pattern variant="dots" size={18} spotlight />
  …
</div>

<Pattern variant="grid" spotlight spotlightColor="#ec4899" spotlightSize={220} />

Pan & pulse#

animate="pan" drifts the pattern diagonally, one tile per cycle; animate="pulse" makes it breathe. speed sets the cycle length in seconds. Both stop for users who prefer reduced motion.

pan · 4s
waves · pan
pulse
<Pattern variant="diagonal" animate="pan" speed={4} />
<Pattern variant="waves" animate="pan" speed={8} color="info" />
<Pattern variant="dots" animate="pulse" color="primary" />

[ Playground ]

Pattern playground#

Try every control together. The code updates as you go.

Move your cursor here

<div style={{ position: 'relative' }}>
  <Pattern
    variant="grid"
    size={28}
    spotlight
  />
  …your content…
</div>
// Change the controls in the preview to generate the code.

Light & dark#

Default colors are derived from the text color, so patterns stay subtle in both themes.

Ship faster

Ship faster

<div className="light">…</div>
<div className="dark">…</div>

[ Patterns ]

Hero background#

[ 01 ]

Build beautiful products

<section style={{ position: 'relative' }}>
  <Pattern variant="grid" size={40} fade="bottom" spotlight />
  <h1>Build beautiful products</h1>
  <Button variant="gradient">Get started</Button>
</section>

Empty state card#

No projects yet

Create your first one to get going.

<Card style={{ position: 'relative' }}>
  <Pattern variant="cross" size={20} fade="radial" />
  <CardBody>…</CardBody>
</Card>

Used in designs#

Pattern in real layouts: these 7 designs use it. Open one to try it and copy the code.

API reference#

<Pattern />

Renders an aria-hidden, pointer-transparent <div> that fills its position: relative parent. Also accepts every <div> attribute.

variant'grid'
'grid' | 'dots' | 'lines' | 'diagonal' | 'cross' | 'checker' | 'waves'

Pattern shape.

size24
number | CSS length

Tile size.

thickness1
number | CSS length

Line width (dot radius for dots).

color-
semantic | CSS color

Pattern color. Defaults to a soft tint of the text color.

opacity1
number

Overall opacity.

fadetrue (radial)
boolean | 'radial' | 'top' | 'bottom' | 'left' | 'right' | 'edges'

Fade mask; false for none.

animate-
'pan' | 'pulse'

Slow drift or breathing animation.

speed6 / 3
number | CSS time

Animation cycle in seconds.

spotlightfalse
boolean

Light the pattern around the cursor (listens on the parent).

spotlightColorprimary 55%
semantic | CSS color

Spotlight color.

spotlightSize160
number | CSS length

Spotlight radius.

Accessibility#

  • aria-hidden and pointer-events: none, so it never interferes with content or clicks.
  • Animations are disabled when the user prefers reduced motion.
  • Keep text on top of patterns at full contrast; lower the pattern opacity if needed.