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

DotPattern

dot-pattern

Draws a token-colored repeating dot background with an SVG pattern.

Usage

Basic usage

Place a layer of DotPattern in the relative container to get a dot matrix background. The default is 16px unit and text-border theme.

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

Adjust density and point diameter

width/height control unit spacing, cr control point radius - increase the spacing and thicken the points to obtain a sparse and large lattice.

tsx
<div className="relative h-48 w-full overflow-hidden rounded-xl border border-border bg-surface">
  <DotPattern width={28} height={28} cr={1.6} />
</div>

Change color (eat theme)

Select currentColor as the color, and use the text-* tool to change the color, and the light and dark themes will be automatically adapted.

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

Mask fade

Overlay mask-image to make the dot matrix fade toward the edge, often used in hero/card background to avoid hard edges.

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

When to Use

Add a dot matrix texture base to the card/block/Hero. Use this component for dotted textures; use GridPattern for line grids, StripedPattern for diagonal stripes, and Spotlight for radial glow.

Import

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

Props

NameTypeDefaultDescription
widthnumber16Tile unit width
heightnumber16Tile unit height
cxnumber1The x offset of the point within the cell
cynumber1The y offset of the point within the cell
crnumber1Point Radius
xnumber0pattern overall x offset
ynumber0pattern overall y offset
Inherits ComponentPropsWithoutRef<"svg"> (className, etc.). The color is currentColor, which is controlled by the text-* tool class (such as text-muted-foreground).

Usage Guidelines

  • The internal absolute inset-0 is filled with the parent and must be placed inside the relative (and usually overflow-hidden) positioning container, otherwise it cannot be positioned/will overflow.
  • The color depends on currentColor, use text-* to change the color instead of fill.

Related

GridPattern · StripedPattern · Spotlight · RetroGrid · Ripple · Meteors

Playground

<div className="relative">
  <DotPattern width={16} cr={1} />
</div>
PreviousCitationDecorationNextGridPattern

On this page

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