Grid pattern
A decorative line grid background drawn in SVG with currentColor.
SourceStyles source@monoline/react 0.4.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:
grid-pattern.css
Import
import '@monoline/css';
import {GridPattern} from '@monoline/react';
Not installed yet? Pick a route.
Copies the source and its styles into your project.
npx monoline add grid-pattern
Usage
import {GridPattern} from '@monoline/react';
<div style={{position: 'relative', height: 200, display: 'grid', placeItems: 'center', border: '1px solid var(--rule)'}}>
<GridPattern fade />
<span style={{position: 'relative'}}>Content sits above</span>
</div>
Examples
Accent, larger cells
Props
GridPatternProps
| Prop | Type | Default | Description |
|---|---|---|---|
size | number | 32 | Cell size in px. Default 32. |
fade | boolean | – | Fade the lines 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 |
|---|---|
.grid-pattern | grid-pattern.css |
.grid-pattern-fade | grid-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
.grid-pattern {
border-color: var(--accent);
}
Accessibility
- Decorative: aria-hidden and not focusable, so it adds nothing to the reading order.
- Static; no motion.