Control the grid dimensions of your Lumidot animations with rows and cols props
Lumidot animations are built on a grid system. You can configure the number of rows and columns to create loading animations of different shapes and sizes.
The dot size is determined by dividing the base size by the larger dimension (Math.max(rows, cols)). This ensures rectangular grids maintain proportional dots.
// Horizontal line at the top<Lumidot pattern="line-h-top" rows={5} cols={7} />// Middle column<Lumidot pattern="line-v-mid" rows={5} cols={5} />// Diagonal from top-left to bottom-right<Lumidot pattern="line-diag-1" rows={5} cols={5} />
From index.tsx:13-42, line patterns use grid-aware functions:
function topRow(rows: number, cols: number): number[] { return Array.from({ length: cols }, (_, c) => c);}function midCol(rows: number, cols: number): number[] { const c = Math.floor(cols / 2); return Array.from({ length: rows }, (_, r) => r * cols + c);}function diag1(rows: number, cols: number): number[] { const n = Math.min(rows, cols); return Array.from({ length: n }, (_, i) => i * cols + i);}
// Animates around the perimeter<Lumidot pattern="frame" rows={4} cols={6} />// All perimeter dots at once<Lumidot pattern="frame-sync" rows={5} cols={5} />
// Center dot (calculated from grid dimensions)<Lumidot pattern="solo-center" rows={5} cols={5} />// All four corners simultaneously<Lumidot pattern="corners-sync" rows={4} cols={6} />
The center is calculated at index.tsx:33-35:
function center(rows: number, cols: number): number { return Math.floor(rows / 2) * cols + Math.floor(cols / 2);}
You can adjust both grid size and scale to create loading animations of any dimensions:
// Small 5×5 grid<Lumidot pattern="wave-lr" variant="blue" rows={5} cols={5} scale={0.5}/>// Large 7×7 grid<Lumidot pattern="spiral" variant="purple" rows={7} cols={7} scale={2}/>
For wave patterns like wave-lr, wave-rl, wave-tb, and wave-bt, larger grids create more pronounced wave effects with smoother animations.
Very large grids (10×10 or more) may impact performance, as each dot is rendered as a separate DOM element. Use scale to increase visual size rather than adding more dots when possible.
Next Steps
Learn how to control animation timing and direction