diff --git a/apps/www/config/docs.ts b/apps/www/config/docs.ts index f568ca9c6..94373d121 100644 --- a/apps/www/config/docs.ts +++ b/apps/www/config/docs.ts @@ -609,6 +609,12 @@ export const docsConfig: DocsConfig = { items: [], label: "", }, + { + title: "Backlight", + href: `/docs/components/backlight`, + items: [], + label: "New", + }, ], }, ], diff --git a/apps/www/content/docs/components/backlight.mdx b/apps/www/content/docs/components/backlight.mdx new file mode 100644 index 000000000..e4f422d01 --- /dev/null +++ b/apps/www/content/docs/components/backlight.mdx @@ -0,0 +1,75 @@ +--- +title: Backlight +date: 2026-03-27 +description: A backlight glow effect for videos, images, and SVGs. +author: abdmjd1 +published: true +--- + + + +## Installation + + + + + CLI + Manual + + + +```bash +npx shadcn@latest add @magicui/backlight +``` + + + + + + + +Copy and paste the following code into your project. + + + +Update the import paths to match your project setup. + + + + + + + +## Examples + +### Image + + + +### SVG + + + +## Usage + +```tsx showLineNumbers +import { Backlight } from "@/components/ui/backlight" +``` + +```tsx showLineNumbers + + + +``` + +## Props + +| Prop | Type | Default | Description | +| ----------- | -------------------- | ------- | ------------------------------------------------------------------ | +| `blur` | `number` | `20` | The blur intensity of the backlight glow effect. | +| `children` | `React.ReactElement` | `-` | The video, image, or SVG element to apply the backlight effect to. | +| `className` | `string` | `-` | Additional class names for the wrapper div. | + +## Credits + +- Credit to [@abdmjd1](https://github.com/abdmjd1) diff --git a/apps/www/public/llms-full.txt b/apps/www/public/llms-full.txt index 0b3dae9c8..60be77c95 100644 --- a/apps/www/public/llms-full.txt +++ b/apps/www/public/llms-full.txt @@ -3436,6 +3436,188 @@ export default function AvatarCirclesDemo() { +===== COMPONENT: backlight ===== +Title: Backlight +Description: A backlight glow effect for videos, images, and SVGs. + +--- file: magicui/backlight.tsx --- +import { useId, type ReactElement } from "react" + +type BacklightProps = { + children?: ReactElement + className?: string + blur?: number +} + +export function Backlight({ blur = 20, children, className }: BacklightProps) { + const id = useId() + + return ( +
+ + +
{children}
+
+ ) +} + + +===== EXAMPLE: backlight-video-demo ===== +Title: backlight-video-demo + +--- file: example/backlight-video-demo.tsx --- +import { Backlight } from "@/registry/magicui/backlight" + +export default function BacklightVideoDemo() { + return ( + + + + ) +} + + +===== EXAMPLE: backlight-image-demo ===== +Title: backlight-image-demo + +--- file: example/backlight-image-demo.tsx --- +import { Backlight } from "@/registry/magicui/backlight" + +export default function BacklightImageDemo() { + return ( + + fancy gradient background + + ) +} + + +===== EXAMPLE: backlight-svg-demo ===== +Title: backlight-svg-demo + +--- file: example/backlight-svg-demo.tsx --- +import { Backlight } from "@/registry/magicui/backlight" + +export default function BacklightSVGDemo() { + return ( + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ ) +} + + + ===== COMPONENT: bento-grid ===== Title: Bento Grid Description: Bento grid is a layout used to showcase the features of a product in a simple and elegant way. diff --git a/apps/www/public/llms.txt b/apps/www/public/llms.txt index 6257d84cb..bbed3d35b 100644 --- a/apps/www/public/llms.txt +++ b/apps/www/public/llms.txt @@ -16,6 +16,7 @@ This file provides LLM-friendly entry points to documentation and examples. - [Theme Toggler](https://magicui.design/docs/components/animated-theme-toggler): A component for theme changing animation. - [Aurora Text](https://magicui.design/docs/components/aurora-text): A beautiful aurora text effect - [Avatar Circles](https://magicui.design/docs/components/avatar-circles): Overlapping circles of avatars. +- [Backlight](https://magicui.design/docs/components/backlight): A backlight glow effect for videos, images, and SVGs. - [Bento Grid](https://magicui.design/docs/components/bento-grid): Bento grid is a layout used to showcase the features of a product in a simple and elegant way. - [Blur Fade](https://magicui.design/docs/components/blur-fade): Blur fade in and out animation. Used to smoothly fade in and out content. - [Border Beam](https://magicui.design/docs/components/border-beam): An animated beam of light which travels along the border of its container. @@ -216,6 +217,9 @@ This file provides LLM-friendly entry points to documentation and examples. - [Dotted Map Demo](https://github.com/magicuidesign/magicui/blob/main/example/dotted-map-demo.tsx): Example usage - [Dotted Map Demo 2](https://github.com/magicuidesign/magicui/blob/main/example/dotted-map-demo-2.tsx): Example usage - [Dotted Map Demo 3](https://github.com/magicuidesign/magicui/blob/main/example/dotted-map-demo-3.tsx): Example usage +- [backlight-video-demo](https://github.com/magicuidesign/magicui/blob/main/example/backlight-video-demo.tsx): Example usage +- [backlight-image-demo](https://github.com/magicuidesign/magicui/blob/main/example/backlight-image-demo.tsx): Example usage +- [backlight-svg-demo](https://github.com/magicuidesign/magicui/blob/main/example/backlight-svg-demo.tsx): Example usage ## Optional diff --git a/apps/www/public/r/backlight-image-demo.json b/apps/www/public/r/backlight-image-demo.json new file mode 100644 index 000000000..8be944b7e --- /dev/null +++ b/apps/www/public/r/backlight-image-demo.json @@ -0,0 +1,16 @@ +{ + "$schema": "https://ui.shadcn.com/schema/registry-item.json", + "name": "backlight-image-demo", + "type": "registry:example", + "description": "An example of the backlight component with a image.", + "registryDependencies": [ + "@magicui/backlight" + ], + "files": [ + { + "path": "registry/example/backlight-image-demo.tsx", + "content": "import { Backlight } from \"@/registry/magicui/backlight\"\n\nexport default function BacklightImageDemo() {\n return (\n \n \n \n )\n}\n", + "type": "registry:example" + } + ] +} \ No newline at end of file diff --git a/apps/www/public/r/backlight-svg-demo.json b/apps/www/public/r/backlight-svg-demo.json new file mode 100644 index 000000000..7e083fa34 --- /dev/null +++ b/apps/www/public/r/backlight-svg-demo.json @@ -0,0 +1,16 @@ +{ + "$schema": "https://ui.shadcn.com/schema/registry-item.json", + "name": "backlight-svg-demo", + "type": "registry:example", + "description": "An example of the backlight component with SVGs.", + "registryDependencies": [ + "@magicui/backlight" + ], + "files": [ + { + "path": "registry/example/backlight-svg-demo.tsx", + "content": "import { Backlight } from \"@/registry/magicui/backlight\"\n\nexport default function BacklightSVGDemo() {\n return (\n \n
\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
\n
\n )\n}\n", + "type": "registry:example" + } + ] +} \ No newline at end of file diff --git a/apps/www/public/r/backlight-video-demo.json b/apps/www/public/r/backlight-video-demo.json new file mode 100644 index 000000000..d4bb77cf9 --- /dev/null +++ b/apps/www/public/r/backlight-video-demo.json @@ -0,0 +1,16 @@ +{ + "$schema": "https://ui.shadcn.com/schema/registry-item.json", + "name": "backlight-video-demo", + "type": "registry:example", + "description": "An example of the backlight component with a video.", + "registryDependencies": [ + "@magicui/backlight" + ], + "files": [ + { + "path": "registry/example/backlight-video-demo.tsx", + "content": "import { Backlight } from \"@/registry/magicui/backlight\"\n\nexport default function BacklightVideoDemo() {\n return (\n \n \n \n )\n}\n", + "type": "registry:example" + } + ] +} \ No newline at end of file diff --git a/apps/www/public/r/backlight.json b/apps/www/public/r/backlight.json new file mode 100644 index 000000000..282f5fc6f --- /dev/null +++ b/apps/www/public/r/backlight.json @@ -0,0 +1,15 @@ +{ + "$schema": "https://ui.shadcn.com/schema/registry-item.json", + "name": "backlight", + "type": "registry:ui", + "title": "Backlight", + "description": "A backlight glow effect for videos, images, and SVGs.", + "dependencies": [], + "files": [ + { + "path": "registry/magicui/backlight.tsx", + "content": "import { useId, type ReactElement } from \"react\"\n\ntype BacklightProps = {\n children?: ReactElement\n className?: string\n blur?: number\n}\n\nexport function Backlight({ blur = 20, children, className }: BacklightProps) {\n const id = useId()\n\n return (\n
\n \n \n \n \n \n \n \n\n
{children}
\n
\n )\n}\n", + "type": "registry:ui" + } + ] +} \ No newline at end of file diff --git a/apps/www/public/r/registry.json b/apps/www/public/r/registry.json index ec7e83ecd..2bbad9d0e 100644 --- a/apps/www/public/r/registry.json +++ b/apps/www/public/r/registry.json @@ -1246,6 +1246,19 @@ } ] }, + { + "name": "backlight", + "type": "registry:ui", + "title": "Backlight", + "description": "A backlight glow effect for videos, images, and SVGs.", + "dependencies": [], + "files": [ + { + "path": "registry/magicui/backlight.tsx", + "type": "registry:ui" + } + ] + }, { "name": "magic-card-demo", "type": "registry:example", @@ -3376,6 +3389,48 @@ } ] }, + { + "name": "backlight-video-demo", + "type": "registry:example", + "description": "An example of the backlight component with a video.", + "registryDependencies": [ + "@magicui/backlight" + ], + "files": [ + { + "path": "registry/example/backlight-video-demo.tsx", + "type": "registry:example" + } + ] + }, + { + "name": "backlight-image-demo", + "type": "registry:example", + "description": "An example of the backlight component with a image.", + "registryDependencies": [ + "@magicui/backlight" + ], + "files": [ + { + "path": "registry/example/backlight-image-demo.tsx", + "type": "registry:example" + } + ] + }, + { + "name": "backlight-svg-demo", + "type": "registry:example", + "description": "An example of the backlight component with SVGs.", + "registryDependencies": [ + "@magicui/backlight" + ], + "files": [ + { + "path": "registry/example/backlight-svg-demo.tsx", + "type": "registry:example" + } + ] + }, { "name": "utils", "type": "registry:lib", diff --git a/apps/www/public/registry.json b/apps/www/public/registry.json index ec7e83ecd..2bbad9d0e 100644 --- a/apps/www/public/registry.json +++ b/apps/www/public/registry.json @@ -1246,6 +1246,19 @@ } ] }, + { + "name": "backlight", + "type": "registry:ui", + "title": "Backlight", + "description": "A backlight glow effect for videos, images, and SVGs.", + "dependencies": [], + "files": [ + { + "path": "registry/magicui/backlight.tsx", + "type": "registry:ui" + } + ] + }, { "name": "magic-card-demo", "type": "registry:example", @@ -3376,6 +3389,48 @@ } ] }, + { + "name": "backlight-video-demo", + "type": "registry:example", + "description": "An example of the backlight component with a video.", + "registryDependencies": [ + "@magicui/backlight" + ], + "files": [ + { + "path": "registry/example/backlight-video-demo.tsx", + "type": "registry:example" + } + ] + }, + { + "name": "backlight-image-demo", + "type": "registry:example", + "description": "An example of the backlight component with a image.", + "registryDependencies": [ + "@magicui/backlight" + ], + "files": [ + { + "path": "registry/example/backlight-image-demo.tsx", + "type": "registry:example" + } + ] + }, + { + "name": "backlight-svg-demo", + "type": "registry:example", + "description": "An example of the backlight component with SVGs.", + "registryDependencies": [ + "@magicui/backlight" + ], + "files": [ + { + "path": "registry/example/backlight-svg-demo.tsx", + "type": "registry:example" + } + ] + }, { "name": "utils", "type": "registry:lib", diff --git a/apps/www/registry.json b/apps/www/registry.json index ec7e83ecd..2bbad9d0e 100644 --- a/apps/www/registry.json +++ b/apps/www/registry.json @@ -1246,6 +1246,19 @@ } ] }, + { + "name": "backlight", + "type": "registry:ui", + "title": "Backlight", + "description": "A backlight glow effect for videos, images, and SVGs.", + "dependencies": [], + "files": [ + { + "path": "registry/magicui/backlight.tsx", + "type": "registry:ui" + } + ] + }, { "name": "magic-card-demo", "type": "registry:example", @@ -3376,6 +3389,48 @@ } ] }, + { + "name": "backlight-video-demo", + "type": "registry:example", + "description": "An example of the backlight component with a video.", + "registryDependencies": [ + "@magicui/backlight" + ], + "files": [ + { + "path": "registry/example/backlight-video-demo.tsx", + "type": "registry:example" + } + ] + }, + { + "name": "backlight-image-demo", + "type": "registry:example", + "description": "An example of the backlight component with a image.", + "registryDependencies": [ + "@magicui/backlight" + ], + "files": [ + { + "path": "registry/example/backlight-image-demo.tsx", + "type": "registry:example" + } + ] + }, + { + "name": "backlight-svg-demo", + "type": "registry:example", + "description": "An example of the backlight component with SVGs.", + "registryDependencies": [ + "@magicui/backlight" + ], + "files": [ + { + "path": "registry/example/backlight-svg-demo.tsx", + "type": "registry:example" + } + ] + }, { "name": "utils", "type": "registry:lib", diff --git a/apps/www/registry/__index__.tsx b/apps/www/registry/__index__.tsx index a573d7e6b..1719d025d 100644 --- a/apps/www/registry/__index__.tsx +++ b/apps/www/registry/__index__.tsx @@ -1188,6 +1188,23 @@ export const Index: Record = { }), meta: undefined, }, + "backlight": { + name: "backlight", + description: "A backlight glow effect for videos, images, and SVGs.", + type: "registry:ui", + registryDependencies: undefined, + files: [{ + path: "registry/magicui/backlight.tsx", + type: "registry:ui", + target: "" + }], + component: React.lazy(async () => { + const mod = await import("@/registry/magicui/backlight.tsx") + const exportName = Object.keys(mod).find(key => typeof mod[key] === 'function' || typeof mod[key] === 'object') ?? item.name + return { default: mod.default ?? mod[exportName] } + }), + meta: undefined, + }, "magic-card-demo": { name: "magic-card-demo", description: "Example showing a spotlight effect that follows your mouse cursor and highlights borders on hover.", @@ -3538,6 +3555,57 @@ export const Index: Record = { }), meta: undefined, }, + "backlight-video-demo": { + name: "backlight-video-demo", + description: "An example of the backlight component with a video.", + type: "registry:example", + registryDependencies: ["@magicui/backlight"], + files: [{ + path: "registry/example/backlight-video-demo.tsx", + type: "registry:example", + target: "" + }], + component: React.lazy(async () => { + const mod = await import("@/registry/example/backlight-video-demo.tsx") + const exportName = Object.keys(mod).find(key => typeof mod[key] === 'function' || typeof mod[key] === 'object') ?? item.name + return { default: mod.default ?? mod[exportName] } + }), + meta: undefined, + }, + "backlight-image-demo": { + name: "backlight-image-demo", + description: "An example of the backlight component with a image.", + type: "registry:example", + registryDependencies: ["@magicui/backlight"], + files: [{ + path: "registry/example/backlight-image-demo.tsx", + type: "registry:example", + target: "" + }], + component: React.lazy(async () => { + const mod = await import("@/registry/example/backlight-image-demo.tsx") + const exportName = Object.keys(mod).find(key => typeof mod[key] === 'function' || typeof mod[key] === 'object') ?? item.name + return { default: mod.default ?? mod[exportName] } + }), + meta: undefined, + }, + "backlight-svg-demo": { + name: "backlight-svg-demo", + description: "An example of the backlight component with SVGs.", + type: "registry:example", + registryDependencies: ["@magicui/backlight"], + files: [{ + path: "registry/example/backlight-svg-demo.tsx", + type: "registry:example", + target: "" + }], + component: React.lazy(async () => { + const mod = await import("@/registry/example/backlight-svg-demo.tsx") + const exportName = Object.keys(mod).find(key => typeof mod[key] === 'function' || typeof mod[key] === 'object') ?? item.name + return { default: mod.default ?? mod[exportName] } + }), + meta: undefined, + }, "utils": { name: "utils", description: "", diff --git a/apps/www/registry/example/backlight-image-demo.tsx b/apps/www/registry/example/backlight-image-demo.tsx new file mode 100644 index 000000000..e4b2256d9 --- /dev/null +++ b/apps/www/registry/example/backlight-image-demo.tsx @@ -0,0 +1,15 @@ +import { Backlight } from "@/registry/magicui/backlight" + +export default function BacklightImageDemo() { + return ( + + fancy gradient background + + ) +} diff --git a/apps/www/registry/example/backlight-svg-demo.tsx b/apps/www/registry/example/backlight-svg-demo.tsx new file mode 100644 index 000000000..8a6778335 --- /dev/null +++ b/apps/www/registry/example/backlight-svg-demo.tsx @@ -0,0 +1,90 @@ +import { Backlight } from "@/registry/magicui/backlight" + +export default function BacklightSVGDemo() { + return ( + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ ) +} diff --git a/apps/www/registry/example/backlight-video-demo.tsx b/apps/www/registry/example/backlight-video-demo.tsx new file mode 100644 index 000000000..a8b47e2e6 --- /dev/null +++ b/apps/www/registry/example/backlight-video-demo.tsx @@ -0,0 +1,18 @@ +import { Backlight } from "@/registry/magicui/backlight" + +export default function BacklightVideoDemo() { + return ( + + + + ) +} diff --git a/apps/www/registry/magicui/backlight.tsx b/apps/www/registry/magicui/backlight.tsx new file mode 100644 index 000000000..94fcf5563 --- /dev/null +++ b/apps/www/registry/magicui/backlight.tsx @@ -0,0 +1,33 @@ +import { useId, type ReactElement } from "react" + +type BacklightProps = { + children?: ReactElement + className?: string + blur?: number +} + +export function Backlight({ blur = 20, children, className }: BacklightProps) { + const id = useId() + + return ( +
+ + +
{children}
+
+ ) +} diff --git a/apps/www/registry/registry-examples.ts b/apps/www/registry/registry-examples.ts index c91afdeaa..702f6aa65 100644 --- a/apps/www/registry/registry-examples.ts +++ b/apps/www/registry/registry-examples.ts @@ -1840,4 +1840,40 @@ export const examples: Registry["items"] = [ }, ], }, + { + name: "backlight-video-demo", + description: "An example of the backlight component with a video.", + type: "registry:example", + registryDependencies: ["@magicui/backlight"], + files: [ + { + path: "example/backlight-video-demo.tsx", + type: "registry:example", + }, + ], + }, + { + name: "backlight-image-demo", + description: "An example of the backlight component with a image.", + type: "registry:example", + registryDependencies: ["@magicui/backlight"], + files: [ + { + path: "example/backlight-image-demo.tsx", + type: "registry:example", + }, + ], + }, + { + name: "backlight-svg-demo", + description: "An example of the backlight component with SVGs.", + type: "registry:example", + registryDependencies: ["@magicui/backlight"], + files: [ + { + path: "example/backlight-svg-demo.tsx", + type: "registry:example", + }, + ], + }, ] diff --git a/apps/www/registry/registry-ui.ts b/apps/www/registry/registry-ui.ts index fb00913d7..c9e0de4cd 100644 --- a/apps/www/registry/registry-ui.ts +++ b/apps/www/registry/registry-ui.ts @@ -1186,4 +1186,17 @@ export const ui: Registry["items"] = [ }, ], }, + { + name: "backlight", + type: "registry:ui", + title: "Backlight", + description: "A backlight glow effect for videos, images, and SVGs.", + dependencies: [], + files: [ + { + path: "magicui/backlight.tsx", + type: "registry:ui", + }, + ], + }, ]