JGuang

Dot Pattern

Dot Pattern · Magic UI

Preview
npx shadcn@latest add https://jiguang132.com/r/magic-ui/dot-pattern.json

Some upstream demos use online images, videos or tweets. That content depends on network access and third-party services.

Dot Pattern

Install: npx shadcn@latest add https://jiguang132.com/r/magic-ui/dot-pattern.json

Use case

Draw a dot pattern with optional glowing dots.

Native props used by the examples

Extracted from all local examples for this entry, grouped by imported module and native owner, including other Magic components used by compound demos. This is not an exhaustive API or a universal host variant. Inspect spread object declarations and the source types/defaults below.

Owning component propExplanationExample source
DotPattern.className (dot-pattern)Classes on this native component; initialize Tailwind and its required CSS first.examples/dot-pattern-demo.tsx、examples/dot-pattern-linear-gradient.tsx、examples/dot-pattern-with-glow-effect.tsx
DotPattern.width (dot-pattern)Native grid spacing/canvas width according to the owning type.examples/dot-pattern-linear-gradient.tsx
DotPattern.height (dot-pattern)Native cell/canvas height or CSS extent according to the owning type.examples/dot-pattern-linear-gradient.tsx
DotPattern.cx (dot-pattern)Dot center's horizontal coordinate in the repeat cell.examples/dot-pattern-linear-gradient.tsx
DotPattern.cy (dot-pattern)Dot center's vertical coordinate in the repeat cell.examples/dot-pattern-linear-gradient.tsx
DotPattern.cr (dot-pattern)Dot radius in the SVG cell.examples/dot-pattern-linear-gradient.tsx
DotPattern.glow (dot-pattern)Enable dot glow decoration.examples/dot-pattern-with-glow-effect.tsx

Interaction and state checks

  • Dot Pattern Demo — dot-pattern-demo
  • Dot Pattern Linear Gradient — dot-pattern-linear-gradient
  • Dot Pattern with glow effect — dot-pattern-with-glow-effect

These names identify real example entries, not new component props or extra components. Check pointer/keyboard behavior, themes, small screens and failures for the selected example. Decorative effects must not invent disabled/error/submission states. Complete example installation includes the actual dependency closure.

Business integration boundary

width/height set the repeating cell spacing; cx/cy/cr set each dot's position/radius.

Host and motion setup

Initialize Tailwind CSS v4, semantic CSS variables and the dark variant; import the independent local Registry namespace. Reuse an existing next-themes Provider without substituting JGuang UI/Base UI/HeroUI APIs. Mount effects in view and unmount offscreen; provide static alternatives for unavailable Canvas/WebGL or failed remote media. Respect prefers-reduced-motion and verify timer/RAF/observer/listener cleanup: stopping CSS alone does not prove the engine stopped. Examples provide no backend, login, payment or real AI stream. This practical guide is bilingual; detailed upstream references and demo text retain their original language.

Available examples

dot-pattern-demo, dot-pattern-linear-gradient, dot-pattern-with-glow-effect

Demo state and mock data do not provide a backend service. Inspect the component props before wiring real data.

Installation

<Tabs defaultValue="cli"> <TabsList> <TabsTrigger value="cli">CLI</TabsTrigger> <TabsTrigger value="manual">Manual</TabsTrigger> </TabsList> <TabsContent value="cli">
npx shadcn@latest add @magicui/dot-pattern
</TabsContent> <TabsContent value="manual"> <Steps>

<Step>Copy and paste the following code into your project.</Step>

<Step>Update the import paths to match your project setup.</Step>

</Steps> </TabsContent> </Tabs>

Examples

Linear Gradient

With Glow Effect

Usage

import { DotPattern } from "@/components/ui/dot-pattern"
<div className="relative h-[500px] w-full overflow-hidden">
  <DotPattern />
</div>

Props

Dot Pattern

PropTypeDefaultDescription
widthany16Width of the dot pattern
heightany16Height of the dot pattern
xany0X position of the dot
yany0Y position of the dot
cxany1X position of the circle
cyany1Y position of the circle
crany1Radius of the circle
classNamestring-Class name of the dot pattern
glowbooleanfalseActivates the glow effect in the dot pattern

Complete example installation

The component command installs the component. Each example command also includes its actual imported components, native support UI, utilities and pinned dependencies. Helpers are not additional catalog components.

Dot Pattern Demo

npx shadcn@latest add https://jiguang132.com/r/magic-ui/examples/dot-pattern/dot-pattern-demo.json

Default import: @/components/magicui/examples/dot-pattern-demo

Dependencies: clsx@2.1.1, motion@12.42.2, tailwind-merge@3.6.0

Dot Pattern Linear Gradient

npx shadcn@latest add https://jiguang132.com/r/magic-ui/examples/dot-pattern/dot-pattern-linear-gradient.json

Default import: @/components/magicui/examples/dot-pattern-linear-gradient

Dependencies: clsx@2.1.1, motion@12.42.2, tailwind-merge@3.6.0

Dot Pattern with glow effect

npx shadcn@latest add https://jiguang132.com/r/magic-ui/examples/dot-pattern/dot-pattern-with-glow-effect.json

Default import: @/components/magicui/examples/dot-pattern-with-glow-effect

Dependencies: clsx@2.1.1, motion@12.42.2, tailwind-merge@3.6.0

Minimal usage and theme

import Demo from '@/components/magicui/examples/dot-pattern-demo';
import { ThemeProvider } from 'next-themes';
export default function Example() {
  return <ThemeProvider attribute="class" defaultTheme="system" enableSystem><Demo /></ThemeProvider>;
}

Initialize Tailwind CSS v4, semantic color variables and the dark variant first. Reuse an existing next-themes provider rather than nesting another. Next Link examples require a Next.js environment; in static Vite projects adapt the demo links to your router without changing the native component API. Some media and tweets require network access. Examples do not supply authentication or backend services.

Source-backed parameter reference

Implementation signatures and types are generated from the pinned local source. Optional props, native inherited types, union branches and never exclusions are preserved. A forwardRef implementation's ref is a React reference, not an additional business prop.

DotPattern({
  width = 16,
  height = 16,
  x = 0,
  y = 0,
  cx = 1,
  cy = 1,
  cr = 1,
  className,
  glow = false,
  ...props
}: DotPatternProps)
interface DotPatternProps extends React.SVGProps<SVGSVGElement> {
  width?: number
  height?: number
  x?: number
  y?: number
  cx?: number
  cy?: number
  cr?: number
  className?: string
  glow?: boolean
  [key: string]: unknown
}

Destructuring defaults in source

Only defaults written directly in parameter/props destructuring are listed. Conditional expressions, runtime theme and computed values require source inspection; this is not an exhaustive behavior-default list.

// DotPattern
width = 16

// DotPattern
height = 16

// DotPattern
x = 0

// DotPattern
y = 0

// DotPattern
cx = 1

// DotPattern
cy = 1

// DotPattern
cr = 1

// DotPattern
glow = false

Native and external types

External types remain defined by React or native dependencies, not manually expanded into guessed props. The installed version's TypeScript definitions are authoritative.

React.SVGProps<SVGSVGElement>
SVGSVGElement