Skip to content
Thrum

Grid pattern

A background of lines, dots or crosses that fills its parent, for a hero, an empty state or a card that needs texture. It is an SVG pattern in the border colour, so it stays quiet in both themes. It never moves; for light that travels a border, use the border beam.

Install

npx shadcn@latest add @thrum-pro/grid-pattern

This is a Pro component. The command works once your project has a licence key: set up Pro or see pricing.

Props

PropTypeDefaultDescription
variant"grid" | "dots" | "crosses"Default "grid"Lines along every cell edge, a dot at every crossing, or a small cross at every crossing.
sizenumberDefault 24The side of one cell, in pixels. Anything under 4 is drawn as 4.
strokeWidthnumberDefault 1The width of the lines and crosses, in pixels.
dotRadiusnumberDefault 1The radius of each dot, in pixels.
fade"none" | "radial" | "linear"Default "none"Fade the pattern out towards the edges (radial) or towards the bottom (linear), through a CSS mask.
highlightreadonly [x: number, y: number][]Default []Cells to fill with a light tint, by column and row. The top left cell is [0, 0].
interactivebooleanDefault falseIlluminate the cell under the pointer when hovering the parent container. Disabled on touch and under reduced motion.
classNamestring–Extra classes, merged last. A text colour class recolours the pattern.
...propsComponentProps<"svg">–Every other SVG attribute is passed through. The pattern takes no children.

Motion and sound

Motion

  • At rest the pattern does not move.
  • With interactive enabled, the cell beneath the pointer fades in with a primary tint over 150 ms. Disabled on touch devices and under reduced motion.

Sound

Silent. This component makes no sound.

Accessibility

  • The pattern is decoration. It is hidden from screen readers with aria-hidden and takes no pointer events, so text and controls on top of it work as usual.
  • Its marks use the theme's border colour and highlighted cells use the foreground at 8% (shifting to 20% marks with a 14% primary tint under glass materials). Both stay well under the contrast of any text drawn over them.
  • The pattern fills its nearest positioned parent. Give the parent relative and overflow-hidden, and put the content after the pattern in a positioned element so it is drawn on top.

Source

SourcePro

The source comes with Pro

TypeScript source · Copy-paste ready · MIT-compatible for client projects · Includes all dependencies

Files and dependencies

Adds
components/ui/grid-pattern.tsx
Packages
None
Brings along
Nothing

Changelog

  1. 1.0.0 · 2026-12-03First release.

Loading index…

Keyboard shortcuts

/Ctrl KSearch components, docs and actions
?Show this list
AAppearance studio
SSound on or off
MFull or reduced motion
TTheme: auto, light, dark
GSurface: solid or frosted
BBackdrop photograph (under glass)
CCorner radius: square to round
RReplay the demo, on a component page
DDraw new data, on a component page
←→HomeEndMove the cursor in a focused chart
EscClose a dialog, or leave a chart cursor