[ 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.
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#
[ Gallery ]
All patterns#
The parent must be position: relative. Content placed after the pattern sits on top.
<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.
<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.
<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.
<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.
<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.
<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.
- Flight trackerDashboard widgets
- Pattern sign-upAuthentication
- Forgot passwordAuthentication
- Reset passwordAuthentication
- Verify emailAuthentication
- Profile cardSettings & profile
- Upload statusProductivity
API reference#
<Pattern />
Renders an aria-hidden, pointer-transparent <div> that fills its position: relative parent. Also accepts every <div> attribute.
| Prop | Type | Default | Description |
|---|---|---|---|
variant | 'grid' | 'dots' | 'lines' | 'diagonal' | 'cross' | 'checker' | 'waves' | 'grid' | Pattern shape. |
size | number | CSS length | 24 | Tile size. |
thickness | number | CSS length | 1 | Line width (dot radius for dots). |
color | semantic | CSS color | - | Pattern color. Defaults to a soft tint of the text color. |
opacity | number | 1 | Overall opacity. |
fade | boolean | 'radial' | 'top' | 'bottom' | 'left' | 'right' | 'edges' | true (radial) | Fade mask; false for none. |
animate | 'pan' | 'pulse' | - | Slow drift or breathing animation. |
speed | number | CSS time | 6 / 3 | Animation cycle in seconds. |
spotlight | boolean | false | Light the pattern around the cursor (listens on the parent). |
spotlightColor | semantic | CSS color | primary 55% | Spotlight color. |
spotlightSize | number | CSS length | 160 | Spotlight radius. |
variant'grid''grid' | 'dots' | 'lines' | 'diagonal' | 'cross' | 'checker' | 'waves'Pattern shape.
size24number | CSS lengthTile size.
thickness1number | CSS lengthLine width (dot radius for dots).
color-semantic | CSS colorPattern color. Defaults to a soft tint of the text color.
opacity1numberOverall opacity.
fadetrue (radial)boolean | 'radial' | 'top' | 'bottom' | 'left' | 'right' | 'edges'Fade mask; false for none.
animate-'pan' | 'pulse'Slow drift or breathing animation.
speed6 / 3number | CSS timeAnimation cycle in seconds.
spotlightfalsebooleanLight the pattern around the cursor (listens on the parent).
spotlightColorprimary 55%semantic | CSS colorSpotlight color.
spotlightSize160number | CSS lengthSpotlight 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.