UI Library for Design Engineers. Animated components and effects you can copy and paste into your apps. Free. Open Source.
feat: create light rays component
Dillion Vermac4e221049c02
diff --git a/apps/www/content/docs/components/grid-beams.mdx b/apps/www/content/docs/components/grid-beams.mdxdeleted file mode 100644index 9d9b8449..00000000--- a/apps/www/content/docs/components/grid-beams.mdx+++ /dev/null@@ -1,71 +0,0 @@-----title: Grid Beams-date: 2024-08-22-description: A dynamic grid background with animated light beams that create stunning visual effects with customizable rays and grid patterns.-author: Uday-published: true------<ComponentPreview name="grid-beams-demo" />--## Installation--<Tabs defaultValue="cli">--<TabsList>- <TabsTrigger value="cli">CLI</TabsTrigger>- <TabsTrigger value="manual">Manual</TabsTrigger>-</TabsList>-<TabsContent value="cli">--```bash-npx shadcn@latest add @magicui/grid-beams-```--</TabsContent>--<TabsContent value="manual">--<Steps>--<Step>Copy and paste the following code into your project.</Step>--<ComponentSource name="grid-beams" />--<Step>Update the import paths to match your project setup.</Step>--</Steps>--</TabsContent>--</Tabs>--## Usage--```tsx showLineNumbers-import { GridBeams } from "@/components/magicui/grid-beams"-```--```tsx showLineNumbers-<GridBeams>- <div className="flex h-96 items-center justify-center">- <h2 className="text-2xl font-bold text-white">Grid Beams Effect</h2>- </div>-</GridBeams>-```--## Props--| Prop | Type | Default | Description |-| ----------------- | ----------------- | ---------------------------- | --------------------------------------------- |-| `children` | `React.ReactNode` | - | Content to display over the grid beams effect |-| `gridSize` | `number` | `40` | Size of each grid cell in pixels |-| `gridColor` | `string` | `"rgba(200, 220, 255, 0.2)"` | Color of the grid lines (CSS color value) |-| `rayCount` | `number` | `15` | Number of animated light rays |-| `rayOpacity` | `number` | `0.35` | Opacity of the light rays (0-1) |-| `raySpeed` | `number` | `1` | Speed multiplier for ray animations |-| `rayLength` | `string` | `"45vh"` | Length of the light rays (CSS length value) |-| `gridFadeStart` | `number` | `30` | Start percentage for grid fade effect |-| `gridFadeEnd` | `number` | `90` | End percentage for grid fade effect |-| `backgroundColor` | `string` | `"#020412"` | Background color of the component |-| `className` | `string` | - | Additional CSS classes |diff --git a/apps/www/content/docs/components/light-rays.mdx b/apps/www/content/docs/components/light-rays.mdxnew file mode 100644index 00000000..aff80fdb--- /dev/null+++ b/apps/www/content/docs/components/light-rays.mdx@@ -0,0 +1,66 @@+---+title: Light Rays+date: 2025-09-25+description: A component with animated light rays which shine down from above.+author: dillionverma+published: true+---++<ComponentPreview name="light-rays-demo" />++## Installation++<Tabs defaultValue="cli">++<TabsList>+ <TabsTrigger value="cli">CLI</TabsTrigger>+ <TabsTrigger value="manual">Manual</TabsTrigger>+</TabsList>+<TabsContent value="cli">++```bash+npx shadcn@latest add @magicui/light-rays+```++</TabsContent>++<TabsContent value="manual">++<Steps>++<Step>Copy and paste the following code into your project.</Step>++<ComponentSource name="light-rays" />++<Step>Update the import paths to match your project setup.</Step>++</Steps>++</TabsContent>++</Tabs>++## Usage++```tsx showLineNumbers+import { LightRays } from "@/components/magicui/light-rays"+```++```tsx showLineNumbers+<div className="relative h-[400px] w-full overflow-hidden rounded-xl border">+ <LightRays />+</div>+```++## Props++| Prop | Type | Default | Description |+| ----------- | --------------------- | ---------------------------- | --------------------------------------------------- |+| `count` | `number` | `7` | Total number of animated rays. |+| `color` | `string` | `"rgba(160, 210, 255, 0.2)"` | Base colour used for the gradients. |+| `blur` | `number` | `36` | Pixel radius applied to the blur filter. |+| `opacity` | `number` | `0.65` | Maximum opacity that rays reach (0 – 1). |+| `speed` | `number` | `14` | Average seconds each ray takes to complete a cycle. |+| `length` | `string \| number` | `"70vh"` | CSS length for the ray height. |+| `className` | `string` | `undefined` | Additional class names applied to the wrapper. |+| `style` | `React.CSSProperties` | `undefined` | Inline styles merged into the wrapper. |diff --git a/apps/www/public/llms-full.txt b/apps/www/public/llms-full.txtindex 84c05e10..450c756a 100644--- a/apps/www/public/llms-full.txt+++ b/apps/www/public/llms-full.txt@@ -447,18 +447,6 @@ Title: Globe Demo-===== COMPONENT: grid-beams =====-Title: Grid Beams-Description: A dynamic grid background with animated light beams rays and grid patterns.----===== EXAMPLE: grid-beams-demo =====-Title: grid-beams-demo----===== COMPONENT: grid-pattern =====Title: Grid PatternDescription: A background grid pattern made with SVGs, fully customizable using Tailwind CSS.@@ -617,6 +605,18 @@ Title: Lens Demo 3+===== COMPONENT: light-rays =====+Title: Light Rays+Description: A component with animated light rays which shine down from above.++++===== EXAMPLE: light-rays-demo =====+Title: light-rays-demo++++===== COMPONENT: line-shadow-text =====Title: Line Shadow TextDescription: A text component with a moving line shadow.diff --git a/apps/www/public/llms.txt b/apps/www/public/llms.txtindex 8060f8b1..3974d226 100644--- a/apps/www/public/llms.txt+++ b/apps/www/public/llms.txt@@ -33,7 +33,6 @@ This file provides LLM-friendly entry points to documentation and examples.- [Flickering Grid](https://magicui.design/docs/components/flickering-grid): A flickering grid background made with SVGs, fully customizable using Tailwind CSS.- [Flip Text](https://magicui.design/docs/components/flip-text): Text flipping character animation- [Globe](https://magicui.design/docs/components/globe): An autorotating, interactive, and highly performant globe made using WebGL.-- [Grid Beams](https://magicui.design/docs/components/grid-beams): A dynamic grid background with animated light beams rays and grid patterns.- [Grid Pattern](https://magicui.design/docs/components/grid-pattern): A background grid pattern made with SVGs, fully customizable using Tailwind CSS.- [Hero Video Dialog](https://magicui.design/docs/components/hero-video-dialog): A hero video dialog component.- [Highlighter](https://magicui.design/docs/components/highlighter): A text highlighter that mimics the effect of a human-drawn marker stroke.@@ -43,6 +42,7 @@ This file provides LLM-friendly entry points to documentation and examples.- [interactive-hover-button](https://magicui.design/docs/components/interactive-hover-button): The interactive-hover-button component.- [iPhone](https://magicui.design/docs/components/iphone): A mockup of the iPhone- [Lens](https://magicui.design/docs/components/lens): A interactive component that enables zooming into images, videos and other elements.+- [Light Rays](https://magicui.design/docs/components/light-rays): A component with animated light rays which shine down from above.- [Line Shadow Text](https://magicui.design/docs/components/line-shadow-text): A text component with a moving line shadow.- [Magic Card](https://magicui.design/docs/components/magic-card): A spotlight effect that follows your mouse cursor and highlights borders on hover.- [Marquee](https://magicui.design/docs/components/marquee): An infinite scrolling component that can be used to display text, images, or videos.@@ -212,7 +212,7 @@ This file provides LLM-friendly entry points to documentation and examples.- [Highlighter Demo](https://github.com/magicuidesign/magicui/blob/main/example/highlighter-demo.tsx): Example usage- [Arc Timeline Demo](https://github.com/magicuidesign/magicui/blob/main/example/arc-timeline-demo.tsx): Example usage- [Animated Theme Toggler Demo](https://github.com/magicuidesign/magicui/blob/main/example/animated-theme-toggler-demo.tsx): Example usage-- [grid-beams-demo](https://github.com/magicuidesign/magicui/blob/main/example/grid-beams-demo.tsx): Example usage+- [light-rays-demo](https://github.com/magicuidesign/magicui/blob/main/example/light-rays-demo.tsx): Example usage## Optionaldiff --git a/apps/www/public/r/grid-beams-demo.json b/apps/www/public/r/grid-beams-demo.jsondeleted file mode 100644index 0a505a8d..00000000--- a/apps/www/public/r/grid-beams-demo.json+++ /dev/null@@ -1,16 +0,0 @@-{- "$schema": "https://ui.shadcn.com/schema/registry-item.json",- "name": "grid-beams-demo",- "type": "registry:example",- "description": "Demo of the grid-beams component showcasing animated light rays over a grid",- "registryDependencies": [- "@magicui/grid-beams"- ],- "files": [- {- "path": "registry/example/grid-beams-demo.tsx",- "content": "import { GridBeams } from \"@/registry/magicui/grid-beams\"\n\nexport default function GridBeamsDemo() {\n return (\n <div className=\"relative h-[500px] w-full overflow-hidden rounded-lg border\">\n <GridBeams\n gridSize={0}\n gridColor=\"rgba(255, 255, 255, 0.2)\"\n rayCount={20}\n rayOpacity={0.55}\n raySpeed={1.5}\n rayLength=\"40vh\"\n gridFadeStart={5}\n gridFadeEnd={90}\n className=\"h-full w-full\"\n >\n <div className=\"flex h-full items-center justify-center\">\n <div className=\"mt-50 space-y-6 px-4 text-center\">\n <h1 className=\"text-5xl leading-tight font-bold text-white md:text-7xl\">\n Grid <span className=\"text-blue-400\">BEAMS</span>\n </h1>\n </div>\n </div>\n </GridBeams>\n </div>\n )\n}\n",- "type": "registry:example"- }- ]-}\ No newline at end of filediff --git a/apps/www/public/r/grid-beams.json b/apps/www/public/r/grid-beams.jsondeleted file mode 100644index c2a89495..00000000--- a/apps/www/public/r/grid-beams.json+++ /dev/null@@ -1,17 +0,0 @@-{- "$schema": "https://ui.shadcn.com/schema/registry-item.json",- "name": "grid-beams",- "type": "registry:ui",- "title": "Grid Beams",- "description": "A dynamic grid background with animated light beams rays and grid patterns.",- "dependencies": [- "motion"- ],- "files": [- {- "path": "registry/magicui/grid-beams.tsx",- "content": "\"use client\"\n\nimport React, { HTMLAttributes, useMemo } from \"react\"\nimport { motion } from \"motion/react\"\n\nimport { cn } from \"@/lib/utils\"\n\nconst createGridMask = (start: number, end: number): string => {\n const mid = (start + end) / 2\n return `linear-gradient(to bottom, transparent 0%, rgba(0,0,0,0.05) ${start}%, rgba(0,0,0,0.2) ${mid}%, rgba(0,0,0,0.6) ${end - 20}%, rgba(0,0,0,1) ${end}%)`\n}\n\nconst generateRayConfig = (index: number, total: number) => {\n const progress = index / Math.max(total - 1, 1)\n const leftPercent = 2 + progress * 96\n const rotation = 28 - progress * 56\n const variation = (index * 0.618) % 1\n\n return {\n left: `${leftPercent}%`,\n rotation,\n width: 40 + variation * 25,\n duration: 6 + variation * 5,\n delay: -variation * 10,\n swayDuration: 12 + variation * 9,\n swayDelay: -variation * 10,\n blur: 24 + variation * 9,\n strongSway: index % 2 === 0,\n }\n}\n\ninterface GridBeamsProps extends HTMLAttributes<HTMLDivElement> {\n children: React.ReactNode\n gridSize?: number\n gridColor?: string\n rayCount?: number\n rayOpacity?: number\n raySpeed?: number\n rayLength?: string\n gridFadeStart?: number\n gridFadeEnd?: number\n backgroundColor?: string\n}\n\ninterface LightRayProps {\n left: string\n rotation: number\n width: number\n delay: number\n duration: number\n swayDuration: number\n swayDelay: number\n blurAmount: number\n isStrongerSway: boolean\n opacity: number\n speed: number\n length: string\n}\n\nconst LightRay = React.memo<LightRayProps>(\n ({\n left,\n rotation,\n width,\n delay,\n duration,\n swayDuration,\n swayDelay,\n blurAmount,\n isStrongerSway,\n opacity,\n speed,\n length,\n }) => {\n return (\n <motion.div\n className=\"pointer-events-none absolute -top-[5%] left-[var(--ray-left)] h-[var(--ray-height)] w-[var(--ray-width)] origin-top translate-x-[-50%] rotate-[var(--ray-rotation)] bg-[linear-gradient(to_bottom,rgba(200,220,255,var(--ray-opacity)),rgba(200,220,255,0))] mix-blend-screen blur-[var(--ray-blur)]\"\n style={\n {\n \"--ray-left\": left,\n \"--ray-width\": `${width}px`,\n \"--ray-height\": length,\n \"--ray-opacity\": opacity,\n \"--ray-blur\": `${blurAmount}px`,\n \"--ray-rotation\": `${rotation}deg`,\n } as React.CSSProperties\n }\n animate={{\n opacity: [0.3, 0.7, 0.3],\n transform: [\n `translateX(-50%) rotate(${rotation}deg)`,\n `translateX(-50%) rotate(${rotation + (isStrongerSway ? 1 : 0.5)}deg)`,\n `translateX(-50%) rotate(${rotation}deg)`,\n ],\n }}\n transition={{\n opacity: {\n duration: duration / speed,\n delay: delay / speed,\n repeat: Infinity,\n ease: \"easeInOut\",\n },\n transform: {\n duration: swayDuration / speed,\n delay: swayDelay / speed,\n repeat: Infinity,\n ease: \"easeInOut\",\n },\n }}\n />\n )\n }\n)\n\nexport const GridBeams: React.FC<GridBeamsProps> = ({\n children,\n className,\n gridSize = 40,\n gridColor = \"rgba(200, 220, 255, 0.2)\",\n rayCount = 15,\n rayOpacity = 0.35,\n raySpeed = 1,\n rayLength = \"45vh\",\n gridFadeStart = 30,\n gridFadeEnd = 90,\n backgroundColor = \"#020412\",\n ...props\n}) => {\n const rayConfigs = useMemo(() => {\n return Array.from({ length: rayCount }, (_, i) =>\n generateRayConfig(i, rayCount)\n )\n }, [rayCount])\n\n const gridMask = useMemo(\n () => createGridMask(gridFadeStart, gridFadeEnd),\n [gridFadeStart, gridFadeEnd]\n )\n\n return (\n <div\n className={cn(\n \"relative overflow-hidden bg-[var(--bg-color)] bg-[radial-gradient(ellipse_at_50%_-20%,#1a2c5a,transparent_70%)]\",\n className\n )}\n style={\n {\n \"--bg-color\": backgroundColor,\n } as React.CSSProperties\n }\n {...props}\n >\n <div\n className=\"pointer-events-none absolute inset-0 bg-[linear-gradient(var(--grid-color)_1px,transparent_1px),linear-gradient(90deg,var(--grid-color)_1px,transparent_1px)] [mask-image:var(--grid-mask)] bg-size-[var(--grid-size)_var(--grid-size)] [webkit-mask-image:var(--grid-mask)]\"\n style={\n {\n \"--grid-color\": gridColor,\n \"--grid-size\": `${gridSize}px`,\n \"--grid-mask\": gridMask,\n } as React.CSSProperties\n }\n />\n <div className=\"pointer-events-none absolute inset-0 overflow-hidden\">\n {rayConfigs.map((config, index) => (\n <LightRay\n key={index}\n left={config.left}\n rotation={config.rotation}\n width={config.width}\n delay={config.delay}\n duration={config.duration}\n swayDuration={config.swayDuration}\n swayDelay={config.swayDelay}\n blurAmount={config.blur}\n isStrongerSway={config.strongSway}\n opacity={rayOpacity}\n speed={raySpeed}\n length={rayLength}\n />\n ))}\n </div>\n\n <div className=\"relative z-10\">{children}</div>\n </div>\n )\n}\n",- "type": "registry:ui"- }- ]-}\ No newline at end of filediff --git a/apps/www/public/r/light-rays-demo.json b/apps/www/public/r/light-rays-demo.jsonnew file mode 100644index 00000000..258b676e--- /dev/null+++ b/apps/www/public/r/light-rays-demo.json@@ -0,0 +1,16 @@+{+ "$schema": "https://ui.shadcn.com/schema/registry-item.json",+ "name": "light-rays-demo",+ "type": "registry:example",+ "description": "Demo of the light-rays component showcasing animated light rays",+ "registryDependencies": [+ "@magicui/light-rays"+ ],+ "files": [+ {+ "path": "registry/example/light-rays-demo.tsx",+ "content": "import { LightRays } from \"@/registry/magicui/light-rays\"\n\nexport default function Demo() {\n return (\n <div className=\"relative h-[500px] w-full overflow-hidden rounded-lg border\">\n <div className=\"relative z-10 flex h-full flex-col items-center justify-center gap-4 px-6 text-center\">\n <span className=\"text-xs font-semibold tracking-[0.35em] text-slate-800/60 uppercase dark:text-slate-200/60\">\n Ambient glow\n </span>\n <h1 className=\"text-foreground text-4xl font-bold md:text-5xl\">\n Light Rays\n </h1>\n <p className=\"max-w-md text-sm text-slate-800/80 md:text-base dark:text-slate-200/80\">\n Drop this component into any container and it will fill the space with\n softly animated beams moving across a geometric grid backdrop.\n </p>\n </div>\n <LightRays />\n </div>\n )\n}\n",+ "type": "registry:example"+ }+ ]+}\ No newline at end of filediff --git a/apps/www/public/r/light-rays.json b/apps/www/public/r/light-rays.jsonnew file mode 100644index 00000000..58bd6f75--- /dev/null+++ b/apps/www/public/r/light-rays.json@@ -0,0 +1,17 @@+{+ "$schema": "https://ui.shadcn.com/schema/registry-item.json",+ "name": "light-rays",+ "type": "registry:ui",+ "title": "Light Rays",+ "description": "A component with animated light rays which shine down from above.",+ "dependencies": [+ "motion"+ ],+ "files": [+ {+ "path": "registry/magicui/light-rays.tsx",+ "content": "\"use client\"\n\nimport {\n forwardRef,\n useEffect,\n useState,\n type CSSProperties,\n type HTMLAttributes,\n type ReactNode,\n} from \"react\"\nimport { motion } from \"motion/react\"\n\nimport { cn } from \"@/lib/utils\"\n\nexport type LightRaysProps = Omit<HTMLAttributes<HTMLDivElement>, \"color\"> & {\n children?: ReactNode\n count?: number\n color?: string\n blur?: number\n opacity?: number\n speed?: number\n length?: string\n fill?: boolean\n}\n\ntype LightRay = {\n id: string\n left: number\n rotate: number\n width: number\n swing: number\n delay: number\n duration: number\n intensity: number\n}\n\nconst createRays = (count: number, cycle: number): LightRay[] => {\n if (count <= 0) return []\n\n return Array.from({ length: count }, (_, index) => {\n const left = 8 + Math.random() * 84\n const rotate = -28 + Math.random() * 56\n const width = 160 + Math.random() * 160\n const swing = 0.8 + Math.random() * 1.8\n const delay = Math.random() * cycle\n const duration = cycle * (0.75 + Math.random() * 0.5)\n const intensity = 0.6 + Math.random() * 0.5\n\n return {\n id: `${index}-${Math.round(left * 10)}`,\n left,\n rotate,\n width,\n swing,\n delay,\n duration,\n intensity,\n }\n })\n}\n\nconst Ray = ({\n left,\n rotate,\n width,\n swing,\n delay,\n duration,\n intensity,\n}: LightRay) => {\n return (\n <motion.div\n className=\"pointer-events-none absolute -top-[12%] left-[var(--ray-left)] h-[var(--light-rays-length)] w-[var(--ray-width)] origin-top -translate-x-1/2 rounded-full bg-gradient-to-b from-[color-mix(in_srgb,var(--light-rays-color)_70%,transparent)] to-transparent opacity-0 mix-blend-screen blur-[var(--light-rays-blur)]\"\n style={\n {\n \"--ray-left\": `${left}%`,\n \"--ray-width\": `${width}px`,\n } as CSSProperties\n }\n initial={{ rotate: rotate }}\n animate={{\n opacity: [0, intensity, 0],\n rotate: [rotate - swing, rotate + swing, rotate - swing],\n }}\n transition={{\n duration: duration,\n repeat: Infinity,\n ease: \"easeInOut\",\n delay: delay,\n repeatDelay: duration * 0.1,\n }}\n />\n )\n}\n\nexport const LightRays = forwardRef<HTMLDivElement, LightRaysProps>(\n (\n {\n className,\n style,\n count = 7,\n color = \"rgba(160, 210, 255, 0.2)\",\n blur = 36,\n opacity = 0.65,\n speed = 14,\n length = \"70vh\",\n fill = true,\n ...props\n },\n ref\n ) => {\n const [rays, setRays] = useState<LightRay[]>([])\n const cycleDuration = Math.max(speed, 0.1)\n\n useEffect(() => {\n setRays(createRays(count, cycleDuration))\n }, [count, cycleDuration])\n\n return (\n <div\n ref={ref}\n className={cn(\n \"pointer-events-none absolute inset-0 isolate overflow-hidden rounded-[inherit]\",\n className\n )}\n style={\n {\n \"--light-rays-color\": color,\n \"--light-rays-blur\": `${blur}px`,\n \"--light-rays-length\": length,\n ...style,\n } as CSSProperties\n }\n {...props}\n >\n <div className=\"absolute inset-0 overflow-hidden\">\n <div\n aria-hidden\n className=\"absolute inset-0 opacity-60\"\n style={\n {\n background:\n \"radial-gradient(circle at 20% 15%, color-mix(in srgb, var(--light-rays-color) 45%, transparent), transparent 70%)\",\n } as CSSProperties\n }\n />\n <div\n aria-hidden\n className=\"absolute inset-0 opacity-60\"\n style={\n {\n background:\n \"radial-gradient(circle at 80% 10%, color-mix(in srgb, var(--light-rays-color) 35%, transparent), transparent 75%)\",\n } as CSSProperties\n }\n />\n {rays.map((ray) => (\n <Ray {...ray} />\n ))}\n </div>\n </div>\n )\n }\n)\n\nLightRays.displayName = \"LightRays\"\n",+ "type": "registry:ui"+ }+ ]+}\ No newline at end of filediff --git a/apps/www/public/r/registry.json b/apps/www/public/r/registry.jsonindex a4c2811b..0203135c 100644--- a/apps/www/public/r/registry.json+++ b/apps/www/public/r/registry.json@@ -1295,16 +1295,16 @@}},{- "name": "grid-beams",+ "name": "light-rays","type": "registry:ui",- "title": "Grid Beams",- "description": "A dynamic grid background with animated light beams rays and grid patterns.",+ "title": "Light Rays",+ "description": "A component with animated light rays which shine down from above.","dependencies": ["motion"],"files": [{- "path": "registry/magicui/grid-beams.tsx",+ "path": "registry/magicui/light-rays.tsx","type": "registry:ui"}]@@ -3313,15 +3313,15 @@]},{- "name": "grid-beams-demo",+ "name": "light-rays-demo","type": "registry:example",- "description": "Demo of the grid-beams component showcasing animated light rays over a grid",+ "description": "Demo of the light-rays component showcasing animated light rays","registryDependencies": [- "@magicui/grid-beams"+ "@magicui/light-rays"],"files": [{- "path": "registry/example/grid-beams-demo.tsx",+ "path": "registry/example/light-rays-demo.tsx","type": "registry:example"}]diff --git a/apps/www/registry.json b/apps/www/registry.jsonindex a4c2811b..0203135c 100644--- a/apps/www/registry.json+++ b/apps/www/registry.json@@ -1295,16 +1295,16 @@}},{- "name": "grid-beams",+ "name": "light-rays","type": "registry:ui",- "title": "Grid Beams",- "description": "A dynamic grid background with animated light beams rays and grid patterns.",+ "title": "Light Rays",+ "description": "A component with animated light rays which shine down from above.","dependencies": ["motion"],"files": [{- "path": "registry/magicui/grid-beams.tsx",+ "path": "registry/magicui/light-rays.tsx","type": "registry:ui"}]@@ -3313,15 +3313,15 @@]},{- "name": "grid-beams-demo",+ "name": "light-rays-demo","type": "registry:example",- "description": "Demo of the grid-beams component showcasing animated light rays over a grid",+ "description": "Demo of the light-rays component showcasing animated light rays","registryDependencies": [- "@magicui/grid-beams"+ "@magicui/light-rays"],"files": [{- "path": "registry/example/grid-beams-demo.tsx",+ "path": "registry/example/light-rays-demo.tsx","type": "registry:example"}]diff --git a/apps/www/registry/__index__.tsx b/apps/www/registry/__index__.tsxindex ae26016a..5bcb991f 100644--- a/apps/www/registry/__index__.tsx+++ b/apps/www/registry/__index__.tsx@@ -1239,18 +1239,18 @@ export const Index: Record<string, any> = {}),meta: undefined,},- "grid-beams": {- name: "grid-beams",- description: "A dynamic grid background with animated light beams rays and grid patterns.",+ "light-rays": {+ name: "light-rays",+ description: "A component with animated light rays which shine down from above.",type: "registry:ui",registryDependencies: undefined,files: [{- path: "registry/magicui/grid-beams.tsx",+ path: "registry/magicui/light-rays.tsx",type: "registry:ui",target: ""}],component: React.lazy(async () => {- const mod = await import("@/registry/magicui/grid-beams.tsx")+ const mod = await import("@/registry/magicui/light-rays.tsx")const exportName = Object.keys(mod).find(key => typeof mod[key] === 'function' || typeof mod[key] === 'object') || item.namereturn { default: mod.default || mod[exportName] }}),@@ -3474,18 +3474,18 @@ export const Index: Record<string, any> = {}),meta: undefined,},- "grid-beams-demo": {- name: "grid-beams-demo",- description: "Demo of the grid-beams component showcasing animated light rays over a grid",+ "light-rays-demo": {+ name: "light-rays-demo",+ description: "Demo of the light-rays component showcasing animated light rays",type: "registry:example",- registryDependencies: ["@magicui/grid-beams"],+ registryDependencies: ["@magicui/light-rays"],files: [{- path: "registry/example/grid-beams-demo.tsx",+ path: "registry/example/light-rays-demo.tsx",type: "registry:example",target: ""}],component: React.lazy(async () => {- const mod = await import("@/registry/example/grid-beams-demo.tsx")+ const mod = await import("@/registry/example/light-rays-demo.tsx")const exportName = Object.keys(mod).find(key => typeof mod[key] === 'function' || typeof mod[key] === 'object') || item.namereturn { default: mod.default || mod[exportName] }}),diff --git a/apps/www/registry/example/grid-beams-demo.tsx b/apps/www/registry/example/grid-beams-demo.tsxdeleted file mode 100644index a9edfbc6..00000000--- a/apps/www/registry/example/grid-beams-demo.tsx+++ /dev/null@@ -1,27 +0,0 @@-import { GridBeams } from "@/registry/magicui/grid-beams"--export default function GridBeamsDemo() {- return (- <div className="relative h-[500px] w-full overflow-hidden rounded-lg border">- <GridBeams- gridSize={0}- gridColor="rgba(255, 255, 255, 0.2)"- rayCount={20}- rayOpacity={0.55}- raySpeed={1.5}- rayLength="40vh"- gridFadeStart={5}- gridFadeEnd={90}- className="h-full w-full"- >- <div className="flex h-full items-center justify-center">- <div className="mt-50 space-y-6 px-4 text-center">- <h1 className="text-5xl leading-tight font-bold text-white md:text-7xl">- Grid <span className="text-blue-400">BEAMS</span>- </h1>- </div>- </div>- </GridBeams>- </div>- )-}diff --git a/apps/www/registry/example/light-rays-demo.tsx b/apps/www/registry/example/light-rays-demo.tsxnew file mode 100644index 00000000..6357585a--- /dev/null+++ b/apps/www/registry/example/light-rays-demo.tsx@@ -0,0 +1,21 @@+import { LightRays } from "@/registry/magicui/light-rays"++export default function Demo() {+ return (+ <div className="relative h-[500px] w-full overflow-hidden rounded-lg border">+ <div className="relative z-10 flex h-full flex-col items-center justify-center gap-4 px-6 text-center">+ <span className="text-xs font-semibold tracking-[0.35em] text-slate-800/60 uppercase dark:text-slate-200/60">+ Ambient glow+ </span>+ <h1 className="text-foreground text-4xl font-bold md:text-5xl">+ Light Rays+ </h1>+ <p className="max-w-md text-sm text-slate-800/80 md:text-base dark:text-slate-200/80">+ Drop this component into any container and it will fill the space with+ softly animated beams moving across a geometric grid backdrop.+ </p>+ </div>+ <LightRays />+ </div>+ )+}diff --git a/apps/www/registry/magicui/grid-beams.tsx b/apps/www/registry/magicui/grid-beams.tsxdeleted file mode 100644index a1adcc80..00000000--- a/apps/www/registry/magicui/grid-beams.tsx+++ /dev/null@@ -1,186 +0,0 @@-"use client"--import React, { HTMLAttributes, useMemo } from "react"-import { motion } from "motion/react"--import { cn } from "@/lib/utils"--const createGridMask = (start: number, end: number): string => {- const mid = (start + end) / 2- return `linear-gradient(to bottom, transparent 0%, rgba(0,0,0,0.05) ${start}%, rgba(0,0,0,0.2) ${mid}%, rgba(0,0,0,0.6) ${end - 20}%, rgba(0,0,0,1) ${end}%)`-}--const generateRayConfig = (index: number, total: number) => {- const progress = index / Math.max(total - 1, 1)- const leftPercent = 2 + progress * 96- const rotation = 28 - progress * 56- const variation = (index * 0.618) % 1-- return {- left: `${leftPercent}%`,- rotation,- width: 40 + variation * 25,- duration: 6 + variation * 5,- delay: -variation * 10,- swayDuration: 12 + variation * 9,- swayDelay: -variation * 10,- blur: 24 + variation * 9,- strongSway: index % 2 === 0,- }-}--interface GridBeamsProps extends HTMLAttributes<HTMLDivElement> {- children: React.ReactNode- gridSize?: number- gridColor?: string- rayCount?: number- rayOpacity?: number- raySpeed?: number- rayLength?: string- gridFadeStart?: number- gridFadeEnd?: number- backgroundColor?: string-}--interface LightRayProps {- left: string- rotation: number- width: number- delay: number- duration: number- swayDuration: number- swayDelay: number- blurAmount: number- isStrongerSway: boolean- opacity: number- speed: number- length: string-}--const LightRay = React.memo<LightRayProps>(- ({- left,- rotation,- width,- delay,- duration,- swayDuration,- swayDelay,- blurAmount,- isStrongerSway,- opacity,- speed,- length,- }) => {- return (- <motion.div- className="pointer-events-none absolute -top-[5%] left-[var(--ray-left)] h-[var(--ray-height)] w-[var(--ray-width)] origin-top translate-x-[-50%] rotate-[var(--ray-rotation)] bg-[linear-gradient(to_bottom,rgba(200,220,255,var(--ray-opacity)),rgba(200,220,255,0))] mix-blend-screen blur-[var(--ray-blur)]"- style={- {- "--ray-left": left,- "--ray-width": `${width}px`,- "--ray-height": length,- "--ray-opacity": opacity,- "--ray-blur": `${blurAmount}px`,- "--ray-rotation": `${rotation}deg`,- } as React.CSSProperties- }- animate={{- opacity: [0.3, 0.7, 0.3],- transform: [- `translateX(-50%) rotate(${rotation}deg)`,- `translateX(-50%) rotate(${rotation + (isStrongerSway ? 1 : 0.5)}deg)`,- `translateX(-50%) rotate(${rotation}deg)`,- ],- }}- transition={{- opacity: {- duration: duration / speed,- delay: delay / speed,- repeat: Infinity,- ease: "easeInOut",- },- transform: {- duration: swayDuration / speed,- delay: swayDelay / speed,- repeat: Infinity,- ease: "easeInOut",- },- }}- />- )- }-)--export const GridBeams: React.FC<GridBeamsProps> = ({- children,- className,- gridSize = 40,- gridColor = "rgba(200, 220, 255, 0.2)",- rayCount = 15,- rayOpacity = 0.35,- raySpeed = 1,- rayLength = "45vh",- gridFadeStart = 30,- gridFadeEnd = 90,- backgroundColor = "#020412",- ...props-}) => {- const rayConfigs = useMemo(() => {- return Array.from({ length: rayCount }, (_, i) =>- generateRayConfig(i, rayCount)- )- }, [rayCount])-- const gridMask = useMemo(- () => createGridMask(gridFadeStart, gridFadeEnd),- [gridFadeStart, gridFadeEnd]- )-- return (- <div- className={cn(- "relative overflow-hidden bg-[var(--bg-color)] bg-[radial-gradient(ellipse_at_50%_-20%,#1a2c5a,transparent_70%)]",- className- )}- style={- {- "--bg-color": backgroundColor,- } as React.CSSProperties- }- {...props}- >- <div- className="pointer-events-none absolute inset-0 bg-[linear-gradient(var(--grid-color)_1px,transparent_1px),linear-gradient(90deg,var(--grid-color)_1px,transparent_1px)] [mask-image:var(--grid-mask)] bg-size-[var(--grid-size)_var(--grid-size)] [webkit-mask-image:var(--grid-mask)]"- style={- {- "--grid-color": gridColor,- "--grid-size": `${gridSize}px`,- "--grid-mask": gridMask,- } as React.CSSProperties- }- />- <div className="pointer-events-none absolute inset-0 overflow-hidden">- {rayConfigs.map((config, index) => (- <LightRay- key={index}- left={config.left}- rotation={config.rotation}- width={config.width}- delay={config.delay}- duration={config.duration}- swayDuration={config.swayDuration}- swayDelay={config.swayDelay}- blurAmount={config.blur}- isStrongerSway={config.strongSway}- opacity={rayOpacity}- speed={raySpeed}- length={rayLength}- />- ))}- </div>-- <div className="relative z-10">{children}</div>- </div>- )-}diff --git a/apps/www/registry/magicui/light-rays.tsx b/apps/www/registry/magicui/light-rays.tsxnew file mode 100644index 00000000..4a2508ef--- /dev/null+++ b/apps/www/registry/magicui/light-rays.tsx@@ -0,0 +1,166 @@+"use client"++import {+ forwardRef,+ useEffect,+ useState,+ type CSSProperties,+ type HTMLAttributes,+ type ReactNode,+} from "react"+import { motion } from "motion/react"++import { cn } from "@/lib/utils"++export type LightRaysProps = Omit<HTMLAttributes<HTMLDivElement>, "color"> & {+ children?: ReactNode+ count?: number+ color?: string+ blur?: number+ opacity?: number+ speed?: number+ length?: string+ fill?: boolean+}++type LightRay = {+ id: string+ left: number+ rotate: number+ width: number+ swing: number+ delay: number+ duration: number+ intensity: number+}++const createRays = (count: number, cycle: number): LightRay[] => {+ if (count <= 0) return []++ return Array.from({ length: count }, (_, index) => {+ const left = 8 + Math.random() * 84+ const rotate = -28 + Math.random() * 56+ const width = 160 + Math.random() * 160+ const swing = 0.8 + Math.random() * 1.8+ const delay = Math.random() * cycle+ const duration = cycle * (0.75 + Math.random() * 0.5)+ const intensity = 0.6 + Math.random() * 0.5++ return {+ id: `${index}-${Math.round(left * 10)}`,+ left,+ rotate,+ width,+ swing,+ delay,+ duration,+ intensity,+ }+ })+}++const Ray = ({+ left,+ rotate,+ width,+ swing,+ delay,+ duration,+ intensity,+}: LightRay) => {+ return (+ <motion.div+ className="pointer-events-none absolute -top-[12%] left-[var(--ray-left)] h-[var(--light-rays-length)] w-[var(--ray-width)] origin-top -translate-x-1/2 rounded-full bg-gradient-to-b from-[color-mix(in_srgb,var(--light-rays-color)_70%,transparent)] to-transparent opacity-0 mix-blend-screen blur-[var(--light-rays-blur)]"+ style={+ {+ "--ray-left": `${left}%`,+ "--ray-width": `${width}px`,+ } as CSSProperties+ }+ initial={{ rotate: rotate }}+ animate={{+ opacity: [0, intensity, 0],+ rotate: [rotate - swing, rotate + swing, rotate - swing],+ }}+ transition={{+ duration: duration,+ repeat: Infinity,+ ease: "easeInOut",+ delay: delay,+ repeatDelay: duration * 0.1,+ }}+ />+ )+}++export const LightRays = forwardRef<HTMLDivElement, LightRaysProps>(+ (+ {+ className,+ style,+ count = 7,+ color = "rgba(160, 210, 255, 0.2)",+ blur = 36,+ opacity = 0.65,+ speed = 14,+ length = "70vh",+ fill = true,+ ...props+ },+ ref+ ) => {+ const [rays, setRays] = useState<LightRay[]>([])+ const cycleDuration = Math.max(speed, 0.1)++ useEffect(() => {+ setRays(createRays(count, cycleDuration))+ }, [count, cycleDuration])++ return (+ <div+ ref={ref}+ className={cn(+ "pointer-events-none absolute inset-0 isolate overflow-hidden rounded-[inherit]",+ className+ )}+ style={+ {+ "--light-rays-color": color,+ "--light-rays-blur": `${blur}px`,+ "--light-rays-length": length,+ ...style,+ } as CSSProperties+ }+ {...props}+ >+ <div className="absolute inset-0 overflow-hidden">+ <div+ aria-hidden+ className="absolute inset-0 opacity-60"+ style={+ {+ background:+ "radial-gradient(circle at 20% 15%, color-mix(in srgb, var(--light-rays-color) 45%, transparent), transparent 70%)",+ } as CSSProperties+ }+ />+ <div+ aria-hidden+ className="absolute inset-0 opacity-60"+ style={+ {+ background:+ "radial-gradient(circle at 80% 10%, color-mix(in srgb, var(--light-rays-color) 35%, transparent), transparent 75%)",+ } as CSSProperties+ }+ />+ {rays.map((ray) => (+ <Ray {...ray} />+ ))}+ </div>+ </div>+ )+ }+)++LightRays.displayName = "LightRays"diff --git a/apps/www/registry/registry-examples.ts b/apps/www/registry/registry-examples.tsindex 4e2e5a01..5f5a7ed9 100644--- a/apps/www/registry/registry-examples.ts+++ b/apps/www/registry/registry-examples.ts@@ -1734,14 +1734,14 @@ export const examples: Registry["items"] = [],},{- name: "grid-beams-demo",+ name: "light-rays-demo",description:- "Demo of the grid-beams component showcasing animated light rays over a grid",+ "Demo of the light-rays component showcasing animated light rays",type: "registry:example",- registryDependencies: ["@magicui/grid-beams"],+ registryDependencies: ["@magicui/light-rays"],files: [{- path: "example/grid-beams-demo.tsx",+ path: "example/light-rays-demo.tsx",type: "registry:example",},],diff --git a/apps/www/registry/registry-ui.ts b/apps/www/registry/registry-ui.tsindex da3829ad..280913a5 100644--- a/apps/www/registry/registry-ui.ts+++ b/apps/www/registry/registry-ui.ts@@ -1223,15 +1223,15 @@ export const ui: Registry["items"] = [},},{- name: "grid-beams",+ name: "light-rays",type: "registry:ui",- title: "Grid Beams",+ title: "Light Rays",description:- "A dynamic grid background with animated light beams rays and grid patterns.",+ "A component with animated light rays which shine down from above.",dependencies: ["motion"],files: [{- path: "magicui/grid-beams.tsx",+ path: "magicui/light-rays.tsx",type: "registry:ui",},],