Components / Structure

Section Grid

A grid whose cells share one line between them, with a mark on every crossing and columns that change at breakpoints.

Rails
Rules
Grids
Marks
Dashes
Fills

Customize

Columns
3
Cells
6
Mark
Line
Outline

Installation

npx shadcn@latest add https://fancyborders.vercel.app/r/section-grid.json

The CLI copies the component into your project, adds anything it is built on, and writes its CSS into your global stylesheet. New to the CLI? See Installation.

Examples

Columns at breakpoints

The column utilities take variants. When the last row is not full, the space left over stays open.

1.2M

requests

48ms

median response

99.98%

uptime

312

deploys

0

incidents

Cells as links

Lines sit in the gaps between cells, so a background on a cell never covers them.

Good to know

  • Set the columns with section-cols-1 to section-cols-8 rather than grid-cols-*. The grid counts its cells to find the last column and the last row, which is how it draws every line once and none on its outer edge.
  • Every direct child is a cell. The lines are each cell's ::after and the marks its ::before, and cells are given position: relative.
  • The counting assumes one track per cell. On a cell that spans, set --fb-cell-right and --fb-cell-bottom to 1 or 0 to say whether it has a line to its right and beneath it.
  • Directly inside page rails the grid stops at the rails instead of crossing them.

API reference

SectionGrid

tsx
import { SectionGrid } from "@/components/ui/section-grid";
PropTypeDefault
variant"solid" | "dashed" | "dotted"

Line style of the lines between cells, and of the outline.

"solid"
mark"plus" | "square" | "dot" | false

Mark drawn on every crossing of two lines.

false
markSizenumber | string

Width and height of each mark. The default depends on the mark: plus, square, dot.

11, 7 or 5
outlineboolean

Draw a border around the whole grid as well.

false

Also accepts every Frame prop and every div attribute. Set the columns with a class from section-cols-1 to section-cols-8.