Skip to content

UI Library for Design Engineers. Animated components and effects you can copy and paste into your apps. Free. Open Source.

feat: add prog blur (#646)

daniel2b4f856c6798
diff --git a/__registry__/index.tsx b/__registry__/index.tsx
index aef12754..9b7d0105 100644
--- a/__registry__/index.tsx
+++ b/__registry__/index.tsx
@@ -249,6 +249,30 @@ export const Index: Record<string, any> = {
}),
meta: undefined,
},
+ "progressive-blur": {
+ name: "progressive-blur",
+ description:
+ "The Progressive Blur component adds a smooth blur gradient effect to scrollable content, indicating more content below or above.",
+ type: "registry:ui",
+ registryDependencies: undefined,
+ files: [
+ {
+ path: "registry/magicui/progressive-blur.tsx",
+ type: "registry:ui",
+ target: "components/magicui/progressive-blur.tsx",
+ },
+ ],
+ component: React.lazy(async () => {
+ const mod = await import("@/registry/magicui/progressive-blur.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,
+ },
"neon-gradient-card": {
name: "neon-gradient-card",
description: "A beautiful neon card effect",
@@ -1926,6 +1950,30 @@ export const Index: Record<string, any> = {
}),
meta: undefined,
},
+ "progressive-blur-demo": {
+ name: "progressive-blur-demo",
+ description:
+ "Example showing progressive blur effect for scrollable content.",
+ type: "registry:example",
+ registryDependencies: ["https://magicui.design/r/progressive-blur"],
+ files: [
+ {
+ path: "registry/example/progressive-blur-demo.tsx",
+ type: "registry:example",
+ target: "components/progressive-blur-demo.tsx",
+ },
+ ],
+ component: React.lazy(async () => {
+ const mod = await import("@/registry/example/progressive-blur-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,
+ },
"neon-gradient-card-demo": {
name: "neon-gradient-card-demo",
description: "Example showing a beautiful neon card effect.",
diff --git a/config/docs.ts b/config/docs.ts
index f3c8deff..05a9478d 100644
--- a/config/docs.ts
+++ b/config/docs.ts
@@ -260,6 +260,12 @@ export const docsConfig: DocsConfig = {
items: [],
label: "",
},
+ {
+ title: "Progressive Blur",
+ href: `/docs/components/progressive-blur`,
+ items: [],
+ label: "New",
+ },
],
},
{
diff --git a/content/docs/components/progressive-blur.mdx b/content/docs/components/progressive-blur.mdx
new file mode 100644
index 00000000..1230aa8d
--- /dev/null
+++ b/content/docs/components/progressive-blur.mdx
@@ -0,0 +1,68 @@
+---
+title: Progressive Blur
+date: 2024-06-01
+description: Add a progressive blur effect to scrollable content
+author: magicui
+published: true
+---
+
+<ComponentPreview name="progressive-blur-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 "https://magicui.design/r/progressive-blur"
+```
+
+</TabsContent>
+
+<TabsContent value="manual">
+
+<Steps>
+
+<Step>Copy and paste the following code into your project.</Step>
+
+<ComponentSource name="progressive-blur" />
+
+<Step>Update the import paths to match your project setup.</Step>
+
+</Steps>
+
+</TabsContent>
+
+</Tabs>
+
+## Usage
+
+```tsx
+import { ProgressiveBlur } from "@/components/magicui/progressive-blur";
+```
+
+```tsx
+<div className="relative h-[400px] w-full overflow-auto">
+ {/* Your scrollable content */}
+ <div className="p-4 space-y-4">{/* Content items */}</div>
+
+ <ProgressiveBlur height="50%" position="bottom" />
+</div>
+```
+
+## Props
+
+### ProgressiveBlur
+
+| Prop | Type | Default | Description |
+| ------------ | ----------------------------- | ------------------------------- | ----------------------------------------------------- |
+| `className` | `string` | `-` | Additional classes to apply to the blur container. |
+| `height` | `string` | `"30%"` | Height of the blur effect container. |
+| `position` | `"top" \| "bottom" \| "both"` | `"bottom"` | Position of the blur effect. |
+| `blurLevels` | `number[]` | `[0.5, 1, 2, 4, 8, 16, 32, 64]` | Array of blur values (in px) for progressive effect. |
+| `children` | `React.ReactNode` | `-` | Optional content to render within the blur container. |
diff --git a/public/r/pixel-image.json b/public/r/pixel-image.json
index 27c9e4e8..c2a1fe38 100644
--- a/public/r/pixel-image.json
+++ b/public/r/pixel-image.json
@@ -7,7 +7,7 @@
"files": [
{
"path": "registry/magicui/pixel-image.tsx",
- "content": "\"use client\";\nimport Image from \"next/image\";\nimport { useEffect, useState } from \"react\";\n\ntype Grid = {\n rows: number;\n cols: number;\n};\n\nconst DEFAULT_GRIDS: Record<string, Grid> = {\n \"6x4\": { rows: 4, cols: 6 },\n \"8x8\": { rows: 8, cols: 8 },\n \"8x3\": { rows: 3, cols: 8 },\n \"4x6\": { rows: 6, cols: 4 },\n \"3x8\": { rows: 8, cols: 3 },\n};\n\ntype PredefinedGridKey = keyof typeof DEFAULT_GRIDS;\n\ninterface PixelImageProps {\n src: string;\n grid?: PredefinedGridKey;\n customGrid?: Grid;\n grayscaleAnimation?: boolean;\n pixelFadeInDuration?: number; // in ms\n maxAnimationDelay?: number; // in ms\n colorRevealDelay?: number; // in ms\n}\n\nconst PixelImage = ({\n src,\n grid = \"6x4\",\n grayscaleAnimation = true,\n pixelFadeInDuration = 1000,\n maxAnimationDelay = 1200,\n colorRevealDelay = 1500,\n customGrid,\n}: PixelImageProps) => {\n const [isVisible, setIsVisible] = useState(false);\n const [showColor, setShowColor] = useState(false);\n\n const MIN_GRID = 1;\n const MAX_GRID = 16;\n\n const isValidGrid = (grid?: Grid) => {\n if (!grid) return false;\n const { rows, cols } = grid;\n return (\n Number.isInteger(rows) &&\n Number.isInteger(cols) &&\n rows >= MIN_GRID &&\n cols >= MIN_GRID &&\n rows <= MAX_GRID &&\n cols <= MAX_GRID\n );\n };\n\n const { rows, cols } = isValidGrid(customGrid)\n ? customGrid!\n : DEFAULT_GRIDS[grid];\n const total = rows * cols;\n\n useEffect(() => {\n setIsVisible(true);\n const colorTimeout = setTimeout(() => {\n setShowColor(true);\n }, colorRevealDelay);\n return () => clearTimeout(colorTimeout);\n }, [colorRevealDelay]);\n\n const pieces = Array.from({ length: total }, (_, index) => {\n const row = Math.floor(index / cols);\n const col = index % cols;\n\n const clipPath = `polygon(\n ${col * (100 / cols)}% ${row * (100 / rows)}%,\n ${(col + 1) * (100 / cols)}% ${row * (100 / rows)}%,\n ${(col + 1) * (100 / cols)}% ${(row + 1) * (100 / rows)}%,\n ${col * (100 / cols)}% ${(row + 1) * (100 / rows)}%\n )`;\n\n const delay = Math.random() * maxAnimationDelay;\n return {\n clipPath,\n delay,\n };\n });\n\n return (\n <div className=\"w-72 h-72 md:w-96 md:h-96 relative select-none\">\n {pieces.map((piece, index) => (\n <div\n key={index}\n className={`absolute inset-0 transition-all ease-out ${\n isVisible ? \"opacity-100\" : \"opacity-0\"\n }`}\n style={{\n clipPath: piece.clipPath,\n transitionDelay: `${piece.delay}ms`,\n transitionDuration: `${pixelFadeInDuration}ms`,\n }}\n >\n <Image\n src={src}\n fill\n alt={`Pixel image piece ${index + 1}`}\n className={`object-cover rounded-[2.5rem] transition-all z-1 ${grayscaleAnimation ? `duration-[${pixelFadeInDuration}ms]` : \"\"} ${\n grayscaleAnimation\n ? showColor\n ? \"grayscale-0\"\n : \"grayscale\"\n : \"\"\n }`}\n draggable={false}\n />\n </div>\n ))}\n </div>\n );\n};\n\nexport default PixelImage;\n",
+ "content": "\"use client\";\nimport { cn } from \"@/lib/utils\";\nimport Image from \"next/image\";\nimport { memo, useEffect, useMemo, useState } from \"react\";\n\ntype Grid = {\n rows: number;\n cols: number;\n};\n\nconst DEFAULT_GRIDS: Record<string, Grid> = {\n \"6x4\": { rows: 4, cols: 6 },\n \"8x8\": { rows: 8, cols: 8 },\n \"8x3\": { rows: 3, cols: 8 },\n \"4x6\": { rows: 6, cols: 4 },\n \"3x8\": { rows: 8, cols: 3 },\n};\n\ntype PredefinedGridKey = keyof typeof DEFAULT_GRIDS;\n\ninterface PixelImageProps {\n src: string;\n grid?: PredefinedGridKey;\n customGrid?: Grid;\n grayscaleAnimation?: boolean;\n pixelFadeInDuration?: number; // in ms\n maxAnimationDelay?: number; // in ms\n colorRevealDelay?: number; // in ms\n}\n\nconst PixelImage = ({\n src,\n grid = \"6x4\",\n grayscaleAnimation = true,\n pixelFadeInDuration = 1000,\n maxAnimationDelay = 1200,\n colorRevealDelay = 1300,\n customGrid,\n}: PixelImageProps) => {\n const [isVisible, setIsVisible] = useState(false);\n const [showColor, setShowColor] = useState(false);\n\n const MIN_GRID = 1;\n const MAX_GRID = 16;\n\n const { rows, cols } = useMemo(() => {\n const isValidGrid = (grid?: Grid) => {\n if (!grid) return false;\n const { rows, cols } = grid;\n return (\n Number.isInteger(rows) &&\n Number.isInteger(cols) &&\n rows >= MIN_GRID &&\n cols >= MIN_GRID &&\n rows <= MAX_GRID &&\n cols <= MAX_GRID\n );\n };\n\n return isValidGrid(customGrid) ? customGrid! : DEFAULT_GRIDS[grid];\n }, [customGrid, grid]);\n\n useEffect(() => {\n setIsVisible(true);\n const colorTimeout = setTimeout(() => {\n setShowColor(true);\n }, colorRevealDelay);\n return () => clearTimeout(colorTimeout);\n }, [colorRevealDelay]);\n\n const pieces = useMemo(() => {\n const total = rows * cols;\n return Array.from({ length: total }, (_, index) => {\n const row = Math.floor(index / cols);\n const col = index % cols;\n\n const clipPath = `polygon(\n ${col * (100 / cols)}% ${row * (100 / rows)}%,\n ${(col + 1) * (100 / cols)}% ${row * (100 / rows)}%,\n ${(col + 1) * (100 / cols)}% ${(row + 1) * (100 / rows)}%,\n ${col * (100 / cols)}% ${(row + 1) * (100 / rows)}%\n )`;\n\n const delay = Math.random() * maxAnimationDelay;\n return {\n clipPath,\n delay,\n };\n });\n }, [rows, cols, maxAnimationDelay]);\n\n return (\n <div className=\"relative h-72 w-72 select-none md:h-96 md:w-96\">\n {pieces.map((piece, index) => (\n <div\n key={index}\n className={cn(\n \"absolute inset-0 transition-all ease-out\",\n isVisible ? \"opacity-100\" : \"opacity-0\",\n )}\n style={{\n clipPath: piece.clipPath,\n transitionDelay: `${piece.delay}ms`,\n transitionDuration: `${pixelFadeInDuration}ms`,\n }}\n >\n <Image\n src={src}\n fill\n alt={`Pixel image piece ${index + 1}`}\n className={cn(\n \"z-1 object-cover rounded-[2.5rem]\",\n grayscaleAnimation && (showColor ? \"grayscale-0\" : \"grayscale\"),\n )}\n style={{\n transition: grayscaleAnimation\n ? `filter ${pixelFadeInDuration}ms cubic-bezier(0.4, 0, 0.2, 1)`\n : \"none\",\n }}\n draggable={false}\n />\n </div>\n ))}\n </div>\n );\n};\n\nexport default memo(PixelImage);\n",
"type": "registry:ui",
"target": "components/magicui/pixel-image.tsx"
}
diff --git a/public/r/progressive-blur-demo.json b/public/r/progressive-blur-demo.json
new file mode 100644
index 00000000..48976cb8
--- /dev/null
+++ b/public/r/progressive-blur-demo.json
@@ -0,0 +1,18 @@
+{
+ "$schema": "https://ui.shadcn.com/schema/registry-item.json",
+ "name": "progressive-blur-demo",
+ "type": "registry:example",
+ "title": "Progressive Blur Demo",
+ "description": "Example showing progressive blur effect for scrollable content.",
+ "registryDependencies": [
+ "https://magicui.design/r/progressive-blur"
+ ],
+ "files": [
+ {
+ "path": "registry/example/progressive-blur-demo.tsx",
+ "content": "\"use client\";\n\nimport { ScrollArea } from \"@/components/ui/scroll-area\";\nimport { ProgressiveBlur } from \"@/registry/magicui/progressive-blur\";\n\nexport default function ProgressiveBlurDemo() {\n return (\n <div className=\"relative w-full border rounded-xl\">\n <ScrollArea className=\"relative h-[400px] overflow-hidden\">\n <div className=\"flex flex-col gap-2 p-4\">\n {Array.from({ length: 20 }).map((_, index) => (\n <div\n key={index}\n className=\"flex h-20 w-full items-center justify-center rounded-xl bg-card border\"\n >\n {index}\n </div>\n ))}\n </div>\n <ProgressiveBlur position=\"bottom\" height=\"40%\" />\n </ScrollArea>\n </div>\n );\n}\n",
+ "type": "registry:example",
+ "target": "components/progressive-blur-demo.tsx"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/public/r/progressive-blur.json b/public/r/progressive-blur.json
new file mode 100644
index 00000000..2cd88d47
--- /dev/null
+++ b/public/r/progressive-blur.json
@@ -0,0 +1,15 @@
+{
+ "$schema": "https://ui.shadcn.com/schema/registry-item.json",
+ "name": "progressive-blur",
+ "type": "registry:ui",
+ "title": "Progressive Blur",
+ "description": "The Progressive Blur component adds a smooth blur gradient effect to scrollable content, indicating more content below or above.",
+ "files": [
+ {
+ "path": "registry/magicui/progressive-blur.tsx",
+ "content": "\"use client\";\n\nimport { cn } from \"@/lib/utils\";\nimport React from \"react\";\n\nexport interface ProgressiveBlurProps {\n className?: string;\n height?: string;\n position?: \"top\" | \"bottom\" | \"both\";\n blurLevels?: number[];\n children?: React.ReactNode;\n}\n\nexport function ProgressiveBlur({\n className,\n height = \"30%\",\n position = \"bottom\",\n blurLevels = [0.5, 1, 2, 4, 8, 16, 32, 64],\n}: ProgressiveBlurProps) {\n // Create array with length equal to blurLevels.length - 2 (for before/after pseudo elements)\n const divElements = Array(blurLevels.length - 2).fill(null);\n\n return (\n <div\n className={cn(\n \"gradient-blur pointer-events-none absolute z-10 inset-x-0\",\n className,\n position === \"top\"\n ? \"top-0\"\n : position === \"bottom\"\n ? \"bottom-0\"\n : \"inset-y-0\",\n )}\n style={{\n height: position === \"both\" ? \"100%\" : height,\n }}\n >\n {/* First blur layer (pseudo element) */}\n <div\n className=\"absolute inset-0\"\n style={{\n zIndex: 1,\n backdropFilter: `blur(${blurLevels[0]}px)`,\n WebkitBackdropFilter: `blur(${blurLevels[0]}px)`,\n maskImage:\n position === \"bottom\"\n ? `linear-gradient(to bottom, rgba(0,0,0,0) 0%, rgba(0,0,0,1) 12.5%, rgba(0,0,0,1) 25%, rgba(0,0,0,0) 37.5%)`\n : position === \"top\"\n ? `linear-gradient(to top, rgba(0,0,0,0) 0%, rgba(0,0,0,1) 12.5%, rgba(0,0,0,1) 25%, rgba(0,0,0,0) 37.5%)`\n : `linear-gradient(rgba(0,0,0,0) 0%, rgba(0,0,0,1) 5%, rgba(0,0,0,1) 95%, rgba(0,0,0,0) 100%)`,\n WebkitMaskImage:\n position === \"bottom\"\n ? `linear-gradient(to bottom, rgba(0,0,0,0) 0%, rgba(0,0,0,1) 12.5%, rgba(0,0,0,1) 25%, rgba(0,0,0,0) 37.5%)`\n : position === \"top\"\n ? `linear-gradient(to top, rgba(0,0,0,0) 0%, rgba(0,0,0,1) 12.5%, rgba(0,0,0,1) 25%, rgba(0,0,0,0) 37.5%)`\n : `linear-gradient(rgba(0,0,0,0) 0%, rgba(0,0,0,1) 5%, rgba(0,0,0,1) 95%, rgba(0,0,0,0) 100%)`,\n }}\n />\n\n {/* Middle blur layers */}\n {divElements.map((_, index) => {\n const blurIndex = index + 1;\n const startPercent = blurIndex * 12.5;\n const midPercent = (blurIndex + 1) * 12.5;\n const endPercent = (blurIndex + 2) * 12.5;\n\n const maskGradient =\n position === \"bottom\"\n ? `linear-gradient(to bottom, rgba(0,0,0,0) ${startPercent}%, rgba(0,0,0,1) ${midPercent}%, rgba(0,0,0,1) ${endPercent}%, rgba(0,0,0,0) ${endPercent + 12.5}%)`\n : position === \"top\"\n ? `linear-gradient(to top, rgba(0,0,0,0) ${startPercent}%, rgba(0,0,0,1) ${midPercent}%, rgba(0,0,0,1) ${endPercent}%, rgba(0,0,0,0) ${endPercent + 12.5}%)`\n : `linear-gradient(rgba(0,0,0,0) 0%, rgba(0,0,0,1) 5%, rgba(0,0,0,1) 95%, rgba(0,0,0,0) 100%)`;\n\n return (\n <div\n key={`blur-${index}`}\n className=\"absolute inset-0\"\n style={{\n zIndex: index + 2,\n backdropFilter: `blur(${blurLevels[blurIndex]}px)`,\n WebkitBackdropFilter: `blur(${blurLevels[blurIndex]}px)`,\n maskImage: maskGradient,\n WebkitMaskImage: maskGradient,\n }}\n />\n );\n })}\n\n {/* Last blur layer (pseudo element) */}\n <div\n className=\"absolute inset-0\"\n style={{\n zIndex: blurLevels.length,\n backdropFilter: `blur(${blurLevels[blurLevels.length - 1]}px)`,\n WebkitBackdropFilter: `blur(${blurLevels[blurLevels.length - 1]}px)`,\n maskImage:\n position === \"bottom\"\n ? `linear-gradient(to bottom, rgba(0,0,0,0) 87.5%, rgba(0,0,0,1) 100%)`\n : position === \"top\"\n ? `linear-gradient(to top, rgba(0,0,0,0) 87.5%, rgba(0,0,0,1) 100%)`\n : `linear-gradient(rgba(0,0,0,0) 0%, rgba(0,0,0,1) 5%, rgba(0,0,0,1) 95%, rgba(0,0,0,0) 100%)`,\n WebkitMaskImage:\n position === \"bottom\"\n ? `linear-gradient(to bottom, rgba(0,0,0,0) 87.5%, rgba(0,0,0,1) 100%)`\n : position === \"top\"\n ? `linear-gradient(to top, rgba(0,0,0,0) 87.5%, rgba(0,0,0,1) 100%)`\n : `linear-gradient(rgba(0,0,0,0) 0%, rgba(0,0,0,1) 5%, rgba(0,0,0,1) 95%, rgba(0,0,0,0) 100%)`,\n }}\n />\n </div>\n );\n}\n\nexport default ProgressiveBlur;\n",
+ "type": "registry:ui",
+ "target": "components/magicui/progressive-blur.tsx"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/public/registry.json b/public/registry.json
index 07bf7755..09140e7d 100644
--- a/public/registry.json
+++ b/public/registry.json
@@ -209,6 +209,19 @@
}
]
},
+ {
+ "name": "progressive-blur",
+ "type": "registry:ui",
+ "title": "Progressive Blur",
+ "description": "The Progressive Blur component adds a smooth blur gradient effect to scrollable content, indicating more content below or above.",
+ "files": [
+ {
+ "path": "registry/magicui/progressive-blur.tsx",
+ "type": "registry:ui",
+ "target": "components/magicui/progressive-blur.tsx"
+ }
+ ]
+ },
{
"name": "neon-gradient-card",
"type": "registry:ui",
@@ -1512,6 +1525,22 @@
}
]
},
+ {
+ "name": "progressive-blur-demo",
+ "type": "registry:example",
+ "title": "Progressive Blur Demo",
+ "description": "Example showing progressive blur effect for scrollable content.",
+ "registryDependencies": [
+ "https://magicui.design/r/progressive-blur"
+ ],
+ "files": [
+ {
+ "path": "registry/example/progressive-blur-demo.tsx",
+ "type": "registry:example",
+ "target": "components/progressive-blur-demo.tsx"
+ }
+ ]
+ },
{
"name": "neon-gradient-card-demo",
"type": "registry:example",
diff --git a/registry.json b/registry.json
index 07bf7755..09140e7d 100644
--- a/registry.json
+++ b/registry.json
@@ -209,6 +209,19 @@
}
]
},
+ {
+ "name": "progressive-blur",
+ "type": "registry:ui",
+ "title": "Progressive Blur",
+ "description": "The Progressive Blur component adds a smooth blur gradient effect to scrollable content, indicating more content below or above.",
+ "files": [
+ {
+ "path": "registry/magicui/progressive-blur.tsx",
+ "type": "registry:ui",
+ "target": "components/magicui/progressive-blur.tsx"
+ }
+ ]
+ },
{
"name": "neon-gradient-card",
"type": "registry:ui",
@@ -1512,6 +1525,22 @@
}
]
},
+ {
+ "name": "progressive-blur-demo",
+ "type": "registry:example",
+ "title": "Progressive Blur Demo",
+ "description": "Example showing progressive blur effect for scrollable content.",
+ "registryDependencies": [
+ "https://magicui.design/r/progressive-blur"
+ ],
+ "files": [
+ {
+ "path": "registry/example/progressive-blur-demo.tsx",
+ "type": "registry:example",
+ "target": "components/progressive-blur-demo.tsx"
+ }
+ ]
+ },
{
"name": "neon-gradient-card-demo",
"type": "registry:example",
diff --git a/registry/example/progressive-blur-demo.tsx b/registry/example/progressive-blur-demo.tsx
new file mode 100644
index 00000000..c2e65eed
--- /dev/null
+++ b/registry/example/progressive-blur-demo.tsx
@@ -0,0 +1,24 @@
+"use client";
+
+import { ScrollArea } from "@/components/ui/scroll-area";
+import { ProgressiveBlur } from "@/registry/magicui/progressive-blur";
+
+export default function ProgressiveBlurDemo() {
+ return (
+ <div className="relative w-full border rounded-xl">
+ <ScrollArea className="relative h-[400px] overflow-hidden">
+ <div className="flex flex-col gap-2 p-4">
+ {Array.from({ length: 20 }).map((_, index) => (
+ <div
+ key={index}
+ className="flex h-20 w-full items-center justify-center rounded-xl bg-card border"
+ >
+ {index}
+ </div>
+ ))}
+ </div>
+ <ProgressiveBlur position="bottom" height="40%" />
+ </ScrollArea>
+ </div>
+ );
+}
diff --git a/registry/magicui/progressive-blur.tsx b/registry/magicui/progressive-blur.tsx
new file mode 100644
index 00000000..a4af58f5
--- /dev/null
+++ b/registry/magicui/progressive-blur.tsx
@@ -0,0 +1,114 @@
+"use client";
+
+import { cn } from "@/lib/utils";
+import React from "react";
+
+export interface ProgressiveBlurProps {
+ className?: string;
+ height?: string;
+ position?: "top" | "bottom" | "both";
+ blurLevels?: number[];
+ children?: React.ReactNode;
+}
+
+export function ProgressiveBlur({
+ className,
+ height = "30%",
+ position = "bottom",
+ blurLevels = [0.5, 1, 2, 4, 8, 16, 32, 64],
+}: ProgressiveBlurProps) {
+ // Create array with length equal to blurLevels.length - 2 (for before/after pseudo elements)
+ const divElements = Array(blurLevels.length - 2).fill(null);
+
+ return (
+ <div
+ className={cn(
+ "gradient-blur pointer-events-none absolute z-10 inset-x-0",
+ className,
+ position === "top"
+ ? "top-0"
+ : position === "bottom"
+ ? "bottom-0"
+ : "inset-y-0",
+ )}
+ style={{
+ height: position === "both" ? "100%" : height,
+ }}
+ >
+ {/* First blur layer (pseudo element) */}
+ <div
+ className="absolute inset-0"
+ style={{
+ zIndex: 1,
+ backdropFilter: `blur(${blurLevels[0]}px)`,
+ WebkitBackdropFilter: `blur(${blurLevels[0]}px)`,
+ maskImage:
+ position === "bottom"
+ ? `linear-gradient(to bottom, rgba(0,0,0,0) 0%, rgba(0,0,0,1) 12.5%, rgba(0,0,0,1) 25%, rgba(0,0,0,0) 37.5%)`
+ : position === "top"
+ ? `linear-gradient(to top, rgba(0,0,0,0) 0%, rgba(0,0,0,1) 12.5%, rgba(0,0,0,1) 25%, rgba(0,0,0,0) 37.5%)`
+ : `linear-gradient(rgba(0,0,0,0) 0%, rgba(0,0,0,1) 5%, rgba(0,0,0,1) 95%, rgba(0,0,0,0) 100%)`,
+ WebkitMaskImage:
+ position === "bottom"
+ ? `linear-gradient(to bottom, rgba(0,0,0,0) 0%, rgba(0,0,0,1) 12.5%, rgba(0,0,0,1) 25%, rgba(0,0,0,0) 37.5%)`
+ : position === "top"
+ ? `linear-gradient(to top, rgba(0,0,0,0) 0%, rgba(0,0,0,1) 12.5%, rgba(0,0,0,1) 25%, rgba(0,0,0,0) 37.5%)`
+ : `linear-gradient(rgba(0,0,0,0) 0%, rgba(0,0,0,1) 5%, rgba(0,0,0,1) 95%, rgba(0,0,0,0) 100%)`,
+ }}
+ />
+
+ {/* Middle blur layers */}
+ {divElements.map((_, index) => {
+ const blurIndex = index + 1;
+ const startPercent = blurIndex * 12.5;
+ const midPercent = (blurIndex + 1) * 12.5;
+ const endPercent = (blurIndex + 2) * 12.5;
+
+ const maskGradient =
+ position === "bottom"
+ ? `linear-gradient(to bottom, rgba(0,0,0,0) ${startPercent}%, rgba(0,0,0,1) ${midPercent}%, rgba(0,0,0,1) ${endPercent}%, rgba(0,0,0,0) ${endPercent + 12.5}%)`
+ : position === "top"
+ ? `linear-gradient(to top, rgba(0,0,0,0) ${startPercent}%, rgba(0,0,0,1) ${midPercent}%, rgba(0,0,0,1) ${endPercent}%, rgba(0,0,0,0) ${endPercent + 12.5}%)`
+ : `linear-gradient(rgba(0,0,0,0) 0%, rgba(0,0,0,1) 5%, rgba(0,0,0,1) 95%, rgba(0,0,0,0) 100%)`;
+
+ return (
+ <div
+ key={`blur-${index}`}
+ className="absolute inset-0"
+ style={{
+ zIndex: index + 2,
+ backdropFilter: `blur(${blurLevels[blurIndex]}px)`,
+ WebkitBackdropFilter: `blur(${blurLevels[blurIndex]}px)`,
+ maskImage: maskGradient,
+ WebkitMaskImage: maskGradient,
+ }}
+ />
+ );
+ })}
+
+ {/* Last blur layer (pseudo element) */}
+ <div
+ className="absolute inset-0"
+ style={{
+ zIndex: blurLevels.length,
+ backdropFilter: `blur(${blurLevels[blurLevels.length - 1]}px)`,
+ WebkitBackdropFilter: `blur(${blurLevels[blurLevels.length - 1]}px)`,
+ maskImage:
+ position === "bottom"
+ ? `linear-gradient(to bottom, rgba(0,0,0,0) 87.5%, rgba(0,0,0,1) 100%)`
+ : position === "top"
+ ? `linear-gradient(to top, rgba(0,0,0,0) 87.5%, rgba(0,0,0,1) 100%)`
+ : `linear-gradient(rgba(0,0,0,0) 0%, rgba(0,0,0,1) 5%, rgba(0,0,0,1) 95%, rgba(0,0,0,0) 100%)`,
+ WebkitMaskImage:
+ position === "bottom"
+ ? `linear-gradient(to bottom, rgba(0,0,0,0) 87.5%, rgba(0,0,0,1) 100%)`
+ : position === "top"
+ ? `linear-gradient(to top, rgba(0,0,0,0) 87.5%, rgba(0,0,0,1) 100%)`
+ : `linear-gradient(rgba(0,0,0,0) 0%, rgba(0,0,0,1) 5%, rgba(0,0,0,1) 95%, rgba(0,0,0,0) 100%)`,
+ }}
+ />
+ </div>
+ );
+}
+
+export default ProgressiveBlur;
diff --git a/registry/registry-examples.ts b/registry/registry-examples.ts
index 904f77ce..5d1a3215 100644
--- a/registry/registry-examples.ts
+++ b/registry/registry-examples.ts
@@ -198,6 +198,21 @@ export const examples: Registry["items"] = [
},
],
},
+ {
+ name: "progressive-blur-demo",
+ type: "registry:example",
+ title: "Progressive Blur Demo",
+ description:
+ "Example showing progressive blur effect for scrollable content.",
+ registryDependencies: ["https://magicui.design/r/progressive-blur"],
+ files: [
+ {
+ path: "registry/example/progressive-blur-demo.tsx",
+ type: "registry:example",
+ target: "components/progressive-blur-demo.tsx",
+ },
+ ],
+ },
{
name: "neon-gradient-card-demo",
type: "registry:example",
diff --git a/registry/registry-ui.ts b/registry/registry-ui.ts
index 1a2489e0..d9b99a56 100644
--- a/registry/registry-ui.ts
+++ b/registry/registry-ui.ts
@@ -184,6 +184,20 @@ export const ui: Registry["items"] = [
],
dependencies: ["framer-motion"],
},
+ {
+ name: "progressive-blur",
+ type: "registry:ui",
+ title: "Progressive Blur",
+ description:
+ "The Progressive Blur component adds a smooth blur gradient effect to scrollable content, indicating more content below or above.",
+ files: [
+ {
+ path: "registry/magicui/progressive-blur.tsx",
+ type: "registry:ui",
+ target: "components/magicui/progressive-blur.tsx",
+ },
+ ],
+ },
{
name: "neon-gradient-card",
type: "registry:ui",