Hulian UIv0.93.5413 components0 components
  • Start
  • Components
  • Blocks
  • Pages
  • Demos
  • Changelog
ChineseEnglish
  • ComponentsComponents
  • ThemeTheme

Backgrounds

  • DotPattern
  • GridPattern
  • StripedPattern
  • Spotlight
  • FadeMask
  • RetroGrid
  • Ripple
  • Meteors
  • Aurora
  • Particles
  • FlickeringGrid
  • WavyBackground
  • Silk
  • Iridescence
  • Threads
  • Orb
  • LiquidChrome
  • Balatro
  • Ballpit
  • Beams
  • ColorBends
  • DarkVeil
  • Dither
  • DotField
  • EvilEye
  • FaultyTerminal
  • Ferrofluid
  • FloatingLines
  • Galaxy
  • GradientBlinds
  • Grainient
  • GridDistortion
  • GridMotion
  • GridScan
  • Hyperspeed
  • LetterGlitch
  • Lightfall
  • Lightning
  • LightPillar
  • LightRays
  • LineWaves
  • LiquidEther
  • PixelBlast
  • PixelSnow
  • Plasma
  • PlasmaWave
  • Prism
  • PrismaticBurst
  • Radar
  • RippleGrid
  • ShapeGrid
  • SideRays
  • SoftAurora

Overlay Effects

  • BorderBeam
  • ShineBorder
  • GlareHover
  • Lens
  • AnimatedBeam
  • OrbitingCircles
  • ProgressiveBlur
  • CardSpotlight
  • Reveal
  • Antigravity
  • BlobCursor
  • ClickSpark
  • Crosshair
  • ElectricBorder
  • GhostCursor
  • GradualBlur
  • ImageTrail
  • LaserFlow
  • MagicRings
  • Magnet
  • MagnetLines
  • MetaBalls
  • MetallicPaint
  • OrbitImages
  • PixelTrail
  • PixelTransition
  • Ribbons
  • ShapeBlur
  • SplashCursor
  • StarBorder
  • StickerPeel
  • TargetCursor
  • Cubes
  • Tilt
  • BorderGlow
  • GlassIcons
  • GlassSurface
  • Lanyard
  • ModelViewer
  • FluidGlass

GridPattern

grid-pattern

Draws a scalable line grid for decorative section backgrounds.

Usage

Basic usage

Put a layer of GridPattern in the relative container to get the grid background. The default is 40px solid line and text-border eating theme.

tsx
<div className="relative h-48 w-full overflow-hidden rounded-xl border border-border bg-surface">
  <GridPattern />
</div>

Dashed grid

strokeDasharray Pass "4 2", which means replacing the solid lines with dotted lines, to create a detailed blueprint feel with smaller units.

tsx
<div className="relative h-48 w-full overflow-hidden rounded-xl border border-border bg-surface">
  <GridPattern width={24} height={24} strokeDasharray="3 2" />
</div>

Change color (eat theme)

Set the thread color to currentColor, use the text-* tool class to change the color, and automatically adapt the light and dark themes.

tsx
<div className="relative h-48 w-full overflow-hidden rounded-xl border border-border bg-surface">
  <GridPattern className="text-primary" />
</div>

Mask fade

Overlay mask-image to make the grid fade toward the edges, making the hero/block background softer.

tsx
<div className="relative h-48 w-full overflow-hidden rounded-xl border border-border bg-surface">
  <GridPattern className="[mask-image:radial-gradient(closest-side,black,transparent)]" />
</div>

When to Use

Give the block a line grid texture (technical feel/blueprint feel). Use this component for line grids; use DotPattern for dotted textures, StripedPattern for diagonal stripes, and RetroGrid for retro grids with perspective scrolling.

Import

ts
import { GridPattern } from "@hulianui/ui"

Props

NameTypeDefaultDescription
widthnumber40Unit width
heightnumber40Unit height
xnumber0pattern x offset
ynumber0pattern y offset
strokeDasharraystring | number0Grid-line dash pattern; 0 is solid, while a value such as "4 2" creates dashes
Inherited from ComponentPropsWithoutRef<"svg">. The color is currentColor, which is controlled by the text-* tool class.

Usage Guidelines

  • The inner absolute inset-0 overlay parent must be placed inside a relative (and usually overflow-hidden) positioning container.
  • The color depends on currentColor, use text-* to change the color.

Related

DotPattern · StripedPattern · Spotlight · RetroGrid · Ripple · Meteors

Playground

<div className="relative">
  <GridPattern width={40} />
</div>
PreviousDotPatternDecorationNextStripedPattern

On this page

  • Usage
  • Documentation
    • When to Use
    • Import
    • Props
    • Usage Guidelines
    • Related
  • Playground