A grid of lines that rotate to face the cursor, creating a magnetic field effect. Perfect for interactive backgrounds and hero sections.
pnpm dlx shadcn@latest add @componentry/magnet-lines
rows
Number of rows in the grid.
number
9
columns
Number of columns in the grid.
containerSize
Size of the square container.
string
"80vmin"
lineColor
Color of the lines.
"#efefef"
lineWidth
Width (thickness) of each line.
"1vmin"
lineHeight
Height (length) of each line.
"6vmin"
baseAngle
Base rotation angle for the lines.
0
View source
Keep in mind
Need a custom component?
I build bespoke UI components & websites tailored to your brand.
import { MagnetLines } from "@/components/ui/magnet-lines"
<MagnetLines rows={9} columns={9} containerSize="60vmin" lineColor="currentColor" lineWidth="0.8vmin" lineHeight="5vmin" baseAngle={0} />