Swirski UI

Backgrounds

LineGrid

A configurable line grid background with optional heavier accent lines for pop-art surfaces.

Component

37

Request Changes

Import

import { LineGrid } from "@swirski/ui";

Playground

7 controls

Controls

0.34
18
2
4

Usage

<div className="relative h-72 overflow-hidden border-4 border-black bg-[#FFD400]">
  <LineGrid
    className="inset-0"
    color="#0B0B0C"
    opacity={0.34}
    spacing={18}
    thickness={2}
    direction="both"
    accentColor="#FF3131"
    accentEvery={4}
    accentThickness={5}
  />
</div>

Props

17 generated
PropTypeDefaultNotes
accentColorstring-Optional color for heavier accent lines.
accentEverynumber-Adds accent lines every N cells when greater than 1.
accentThicknessstring | number3Thickness for accent lines.
colorstring"#0B0B0C"Fallback color for horizontal and vertical lines.
direction'both' | 'horizontal' | 'vertical'"both"Which line directions to render.
horizontalColorstring-Overrides the horizontal line color.
horizontalSpacingstring | number-Generated from LineGridProps.
horizontalThicknessstring | number-Generated from LineGridProps.
opacityCSSProperties['Opacity']0.2Opacity applied to the grid layer.
size'sm' | 'md' | 'lg'"md"Generated from LineGridProps.
spacingstring | number18Fallback spacing for both directions.
thicknessstring | number1Fallback line thickness for both directions.
tone'default'"default"Generated from LineGridProps.
variant'default' | 'accent'"default"Generated from LineGridProps.
verticalColorstring-Overrides the vertical line color.
verticalSpacingstring | number-Generated from LineGridProps.
verticalThicknessstring | number-Generated from LineGridProps.
...divPropsOmit<HTMLAttributes<HTMLDivElement>, "color">-Forwarded to the root div.
Previous: DotGridNext: DiagonalLines