Dot pattern
A decorative dot grid background drawn in SVG with currentColor.
SourceStyles source@monoline/react 0.5.0Markdown for AI toolsstable
- Built on native elements
- Decorative: aria-hidden and not focusable, so it adds nothing to the reading order.
- Static; no motion.
- Styles in one file:
dot-pattern.css
Import
import '@monoline/css';
import {DotPattern} from '@monoline/react';
Not installed yet? Pick a route.
Copies the source and its styles into your project.
npx monoline add dot-pattern
Usage
import {DotPattern} from '@monoline/react';
<div style={{position: 'relative', height: 200, display: 'grid', placeItems: 'center', border: '1px solid var(--rule)'}}>
<DotPattern fade />
<span style={{position: 'relative'}}>Content sits above</span>
</div>
Examples
Accent, wider gap
Props
DotPatternProps
| Prop | Type | Default | Description |
|---|---|---|---|
gap | number | 16 | Distance between dot centres, in px. Default 16. |
radius | number | 1 | Dot radius, in px. Default 1. |
fade | boolean | – | Fade the pattern out towards the edges. |
Data Attributes
State is exposed through attributes. Style it with these selectors, not with class toggles.
This component sets no state attributes.
CSS classes
| Class | Stylesheet |
|---|---|
.dot-pattern | dot-pattern.css |
.dot-pattern-fade | dot-pattern.css |
Customization
Style it with the kit's tokens in your own CSS, loaded after @monoline/css. Prefer the attributes above over extra classes. See Theming for every token.
app.css
.dot-pattern {
border-color: var(--accent);
}
Accessibility
- Decorative: aria-hidden and not focusable, so it adds nothing to the reading order.
- Static; no motion.