Skip to content

Commit c45d7f0

Browse files
committed
fix(noise-texture): update default prop values and improve documentation
- Changed default values for `frequency`, `octaves`, and `noiseOpacity` in the NoiseTexture component. - Updated documentation to reflect the new default values and improved formatting for better readability. - Adjusted demo examples to utilize the updated `noiseOpacity` prop for consistency.
1 parent df11193 commit c45d7f0

12 files changed

Lines changed: 42 additions & 36 deletions

apps/www/content/docs/components/noise-texture.mdx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -76,13 +76,13 @@ import { NoiseTexture } from "@/components/ui/noise-texture"
7676

7777
### NoiseTexture
7878

79-
| Prop | Type | Default | Description |
80-
| ----------- | -------- | ------- | ------------------------------------------- |
81-
| `className` | `string` || Merged onto the root `svg` (via `cn`) |
82-
| `frequency` | `number` | `0.5` | `baseFrequency` for `feTurbulence` |
83-
| `octaves` | `number` | `4` | `numOctaves` for `feTurbulence` |
84-
| `slope` | `number` | `0.15` | Linear slope per channel after desaturation |
85-
| `noiseOpacity` | `number` | `0.4` | Opacity of the noise `rect` |
79+
| Prop | Type | Default | Description |
80+
| -------------- | -------- | ------- | ------------------------------------------- |
81+
| `className` | `string` || Merged onto the root `svg` (via `cn`) |
82+
| `frequency` | `number` | `0.5` | `baseFrequency` for `feTurbulence` |
83+
| `octaves` | `number` | `4` | `numOctaves` for `feTurbulence` |
84+
| `slope` | `number` | `0.15` | Linear slope per channel after desaturation |
85+
| `noiseOpacity` | `number` | `0.4` | Opacity of the noise `rect` |
8686

8787
## Credits
8888

apps/www/public/llms-full.txt

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12366,12 +12366,12 @@ export interface NoiseTextureProps extends ComponentProps<"svg"> {
1236612366
className?: string
1236712367
/**
1236812368
* `baseFrequency` for `feTurbulence`; higher values yield finer-grained noise.
12369-
* @default 0.5
12369+
* @default 0.4
1237012370
*/
1237112371
frequency?: number
1237212372
/**
1237312373
* `numOctaves` for `feTurbulence`; more octaves add detail at smaller scales.
12374-
* @default 4
12374+
* @default 6
1237512375
*/
1237612376
octaves?: number
1237712377
/**
@@ -12381,25 +12381,25 @@ export interface NoiseTextureProps extends ComponentProps<"svg"> {
1238112381
slope?: number
1238212382
/**
1238312383
* Opacity of the filled noise layer (`rect`).
12384-
* @default 0.4
12384+
* @default 0.6
1238512385
*/
1238612386
noiseOpacity?: number
1238712387
}
1238812388

1238912389
export const NoiseTexture = ({
1239012390
className,
12391-
frequency = 0.5,
12392-
octaves = 4,
12391+
frequency = 0.4,
12392+
octaves = 6,
1239312393
slope = 0.15,
12394-
noiseOpacity = 0.4,
12394+
noiseOpacity = 0.6,
1239512395
...props
1239612396
}: NoiseTextureProps) => {
1239712397
const filterId = useId()
1239812398

1239912399
return (
1240012400
<svg
1240112401
className={cn(
12402-
"pointer-events-none absolute inset-0 z-0 size-full opacity-50 select-none",
12402+
"pointer-events-none absolute inset-0 z-0 size-full opacity-50 select-none dark:opacity-[0.75]",
1240312403
className
1240412404
)}
1240512405
xmlns="http://www.w3.org/2000/svg"
@@ -12441,7 +12441,7 @@ import { NoiseTexture } from "@/registry/magicui/noise-texture"
1244112441

1244212442
export default function NoiseTextureDemo() {
1244312443
return (
12444-
<div className="relative flex h-[500px] w-full flex-col items-center justify-center overflow-hidden rounded-lg border bg-neutral-100 dark:bg-neutral-950">
12444+
<div className="relative flex h-[500px] w-full flex-col items-center justify-center overflow-hidden rounded-lg border bg-neutral-100/80 dark:bg-neutral-950">
1244512445
<NoiseTexture
1244612446
className={cn(
1244712447
"absolute inset-0",
@@ -12472,8 +12472,8 @@ import { NoiseTexture } from "@/registry/magicui/noise-texture"
1247212472
export default function NoiseTextureDemo2() {
1247312473
return (
1247412474
<div className="flex justify-center p-4">
12475-
<Card className="bg-card relative w-full max-w-md overflow-hidden border">
12476-
<NoiseTexture />
12475+
<Card className="bg-card/80 relative w-full max-w-md overflow-hidden border">
12476+
<NoiseTexture noiseOpacity={0.45} />
1247712477
<CardHeader className="relative z-10 space-y-1 pb-4">
1247812478
<CardTitle className="text-xl">The weekly digest</CardTitle>
1247912479
<CardDescription>
@@ -12517,7 +12517,10 @@ export default function NoiseTextureDemo3() {
1251712517
variant="secondary"
1251812518
>
1251912519
<span className="relative z-10 font-medium">Subscribe</span>
12520-
<NoiseTexture className="transition-all group-hover/button:opacity-100" />
12520+
<NoiseTexture
12521+
noiseOpacity={0.45}
12522+
className="transition-all group-hover/button:opacity-100"
12523+
/>
1252112524
</Button>
1252212525
</div>
1252312526
)
@@ -12539,7 +12542,7 @@ export default function NoiseTextureDemo4() {
1253912542
Search with texture
1254012543
</Label>
1254112544
<div className="bg-muted/30 relative overflow-hidden rounded-lg border">
12542-
<NoiseTexture />
12545+
<NoiseTexture noiseOpacity={0.45} />
1254312546
<Input
1254412547
className="relative z-10 border-0 bg-transparent shadow-none focus-visible:ring-2"
1254512548
id="noise-input-demo"

apps/www/public/r/noise-texture-demo-2.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"files": [
1515
{
1616
"path": "registry/example/noise-texture-demo-2.tsx",
17-
"content": "import { Button } from \"@/components/ui/button\"\nimport {\n Card,\n CardContent,\n CardDescription,\n CardHeader,\n CardTitle,\n} from \"@/components/ui/card\"\nimport { Input } from \"@/components/ui/input\"\nimport { Label } from \"@/components/ui/label\"\nimport { NoiseTexture } from \"@/registry/magicui/noise-texture\"\n\nexport default function NoiseTextureDemo2() {\n return (\n <div className=\"flex justify-center p-4\">\n <Card className=\"bg-card relative w-full max-w-md overflow-hidden border\">\n <NoiseTexture />\n <CardHeader className=\"relative z-10 space-y-1 pb-4\">\n <CardTitle className=\"text-xl\">The weekly digest</CardTitle>\n <CardDescription>\n One email on Sundays—new components, tips, and changelog highlights.\n No spam, unsubscribe anytime.\n </CardDescription>\n </CardHeader>\n <CardContent className=\"relative z-10 space-y-4 pt-0\">\n <div className=\"space-y-2\">\n <Label htmlFor=\"newsletter-email\">Email</Label>\n <Input\n id=\"newsletter-email\"\n autoComplete=\"email\"\n placeholder=\"you@company.com\"\n type=\"email\"\n />\n </div>\n <Button className=\"w-full\" type=\"button\">\n Subscribe\n </Button>\n </CardContent>\n </Card>\n </div>\n )\n}\n",
17+
"content": "import { Button } from \"@/components/ui/button\"\nimport {\n Card,\n CardContent,\n CardDescription,\n CardHeader,\n CardTitle,\n} from \"@/components/ui/card\"\nimport { Input } from \"@/components/ui/input\"\nimport { Label } from \"@/components/ui/label\"\nimport { NoiseTexture } from \"@/registry/magicui/noise-texture\"\n\nexport default function NoiseTextureDemo2() {\n return (\n <div className=\"flex justify-center p-4\">\n <Card className=\"bg-card/80 relative w-full max-w-md overflow-hidden border\">\n <NoiseTexture noiseOpacity={0.45} />\n <CardHeader className=\"relative z-10 space-y-1 pb-4\">\n <CardTitle className=\"text-xl\">The weekly digest</CardTitle>\n <CardDescription>\n One email on Sundays—new components, tips, and changelog highlights.\n No spam, unsubscribe anytime.\n </CardDescription>\n </CardHeader>\n <CardContent className=\"relative z-10 space-y-4 pt-0\">\n <div className=\"space-y-2\">\n <Label htmlFor=\"newsletter-email\">Email</Label>\n <Input\n id=\"newsletter-email\"\n autoComplete=\"email\"\n placeholder=\"you@company.com\"\n type=\"email\"\n />\n </div>\n <Button className=\"w-full\" type=\"button\">\n Subscribe\n </Button>\n </CardContent>\n </Card>\n </div>\n )\n}\n",
1818
"type": "registry:example"
1919
}
2020
]

apps/www/public/r/noise-texture-demo-3.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"files": [
1212
{
1313
"path": "registry/example/noise-texture-demo-3.tsx",
14-
"content": "import { Button } from \"@/components/ui/button\"\nimport { NoiseTexture } from \"@/registry/magicui/noise-texture\"\n\nexport default function NoiseTextureDemo3() {\n return (\n <div className=\"flex justify-center p-8\">\n <Button\n className=\"relative cursor-pointer overflow-hidden px-8 active:scale-98\"\n type=\"button\"\n variant=\"secondary\"\n >\n <span className=\"relative z-10 font-medium\">Subscribe</span>\n <NoiseTexture className=\"transition-all group-hover/button:opacity-100\" />\n </Button>\n </div>\n )\n}\n",
14+
"content": "import { Button } from \"@/components/ui/button\"\nimport { NoiseTexture } from \"@/registry/magicui/noise-texture\"\n\nexport default function NoiseTextureDemo3() {\n return (\n <div className=\"flex justify-center p-8\">\n <Button\n className=\"relative cursor-pointer overflow-hidden px-8 active:scale-98\"\n type=\"button\"\n variant=\"secondary\"\n >\n <span className=\"relative z-10 font-medium\">Subscribe</span>\n <NoiseTexture\n noiseOpacity={0.45}\n className=\"transition-all group-hover/button:opacity-100\"\n />\n </Button>\n </div>\n )\n}\n",
1515
"type": "registry:example"
1616
}
1717
]

apps/www/public/r/noise-texture-demo-4.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"files": [
1313
{
1414
"path": "registry/example/noise-texture-demo-4.tsx",
15-
"content": "import { Input } from \"@/components/ui/input\"\nimport { Label } from \"@/components/ui/label\"\nimport { NoiseTexture } from \"@/registry/magicui/noise-texture\"\n\nexport default function NoiseTextureDemo4() {\n return (\n <div className=\"mx-auto flex max-w-sm flex-col gap-3 p-4\">\n <Label className=\"text-muted-foreground\" htmlFor=\"noise-input-demo\">\n Search with texture\n </Label>\n <div className=\"bg-muted/30 relative overflow-hidden rounded-lg border\">\n <NoiseTexture />\n <Input\n className=\"relative z-10 border-0 bg-transparent shadow-none focus-visible:ring-2\"\n id=\"noise-input-demo\"\n placeholder=\"Try typing…\"\n type=\"search\"\n />\n </div>\n </div>\n )\n}\n",
15+
"content": "import { Input } from \"@/components/ui/input\"\nimport { Label } from \"@/components/ui/label\"\nimport { NoiseTexture } from \"@/registry/magicui/noise-texture\"\n\nexport default function NoiseTextureDemo4() {\n return (\n <div className=\"mx-auto flex max-w-sm flex-col gap-3 p-4\">\n <Label className=\"text-muted-foreground\" htmlFor=\"noise-input-demo\">\n Search with texture\n </Label>\n <div className=\"bg-muted/30 relative overflow-hidden rounded-lg border\">\n <NoiseTexture noiseOpacity={0.45} />\n <Input\n className=\"relative z-10 border-0 bg-transparent shadow-none focus-visible:ring-2\"\n id=\"noise-input-demo\"\n placeholder=\"Try typing…\"\n type=\"search\"\n />\n </div>\n </div>\n )\n}\n",
1616
"type": "registry:example"
1717
}
1818
]

apps/www/public/r/noise-texture-demo.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"files": [
1111
{
1212
"path": "registry/example/noise-texture-demo.tsx",
13-
"content": "\"use client\"\n\nimport { cn } from \"@/lib/utils\"\nimport { NoiseTexture } from \"@/registry/magicui/noise-texture\"\n\nexport default function NoiseTextureDemo() {\n return (\n <div className=\"relative flex h-[500px] w-full flex-col items-center justify-center overflow-hidden rounded-lg border bg-neutral-100 dark:bg-neutral-950\">\n <NoiseTexture\n className={cn(\n \"absolute inset-0\",\n \"mask-[radial-gradient(420px_circle_at_center,white,transparent)]\"\n )}\n />\n </div>\n )\n}\n",
13+
"content": "\"use client\"\n\nimport { cn } from \"@/lib/utils\"\nimport { NoiseTexture } from \"@/registry/magicui/noise-texture\"\n\nexport default function NoiseTextureDemo() {\n return (\n <div className=\"relative flex h-[500px] w-full flex-col items-center justify-center overflow-hidden rounded-lg border bg-neutral-100/80 dark:bg-neutral-950\">\n <NoiseTexture\n className={cn(\n \"absolute inset-0\",\n \"mask-[radial-gradient(420px_circle_at_center,white,transparent)]\"\n )}\n />\n </div>\n )\n}\n",
1414
"type": "registry:example"
1515
}
1616
]

apps/www/public/r/noise-texture.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"files": [
88
{
99
"path": "registry/magicui/noise-texture.tsx",
10-
"content": "\"use client\"\n\nimport { useId, type ComponentProps } from \"react\"\n\nimport { cn } from \"@/lib/utils\"\n\nexport interface NoiseTextureProps extends ComponentProps<\"svg\"> {\n /** Extra classes merged onto the root `svg` element. */\n className?: string\n /**\n * `baseFrequency` for `feTurbulence`; higher values yield finer-grained noise.\n * @default 0.5\n */\n frequency?: number\n /**\n * `numOctaves` for `feTurbulence`; more octaves add detail at smaller scales.\n * @default 4\n */\n octaves?: number\n /**\n * Linear slope on each channel after desaturation; adjusts contrast of the noise.\n * @default 0.15\n */\n slope?: number\n /**\n * Opacity of the filled noise layer (`rect`).\n * @default 0.4\n */\n noiseOpacity?: number\n}\n\nexport const NoiseTexture = ({\n className,\n frequency = 0.5,\n octaves = 4,\n slope = 0.15,\n noiseOpacity = 0.4,\n ...props\n}: NoiseTextureProps) => {\n const filterId = useId()\n\n return (\n <svg\n className={cn(\n \"pointer-events-none absolute inset-0 z-0 size-full opacity-50 select-none\",\n className\n )}\n xmlns=\"http://www.w3.org/2000/svg\"\n {...props}\n >\n <filter id={filterId}>\n <feTurbulence\n type=\"fractalNoise\"\n baseFrequency={frequency}\n numOctaves={octaves}\n stitchTiles=\"stitch\"\n />\n <feColorMatrix type=\"saturate\" values=\"0\" />\n <feComponentTransfer>\n <feFuncR type=\"linear\" slope={slope} />\n <feFuncG type=\"linear\" slope={slope} />\n <feFuncB type=\"linear\" slope={slope} />\n </feComponentTransfer>\n </filter>\n <rect\n width=\"100%\"\n height=\"100%\"\n filter={`url(#${filterId})`}\n opacity={noiseOpacity}\n />\n </svg>\n )\n}\n",
10+
"content": "\"use client\"\n\nimport { useId, type ComponentProps } from \"react\"\n\nimport { cn } from \"@/lib/utils\"\n\nexport interface NoiseTextureProps extends ComponentProps<\"svg\"> {\n /** Extra classes merged onto the root `svg` element. */\n className?: string\n /**\n * `baseFrequency` for `feTurbulence`; higher values yield finer-grained noise.\n * @default 0.4\n */\n frequency?: number\n /**\n * `numOctaves` for `feTurbulence`; more octaves add detail at smaller scales.\n * @default 6\n */\n octaves?: number\n /**\n * Linear slope on each channel after desaturation; adjusts contrast of the noise.\n * @default 0.15\n */\n slope?: number\n /**\n * Opacity of the filled noise layer (`rect`).\n * @default 0.6\n */\n noiseOpacity?: number\n}\n\nexport const NoiseTexture = ({\n className,\n frequency = 0.4,\n octaves = 6,\n slope = 0.15,\n noiseOpacity = 0.6,\n ...props\n}: NoiseTextureProps) => {\n const filterId = useId()\n\n return (\n <svg\n className={cn(\n \"pointer-events-none absolute inset-0 z-0 size-full opacity-50 select-none dark:opacity-[0.75]\",\n className\n )}\n xmlns=\"http://www.w3.org/2000/svg\"\n {...props}\n >\n <filter id={filterId}>\n <feTurbulence\n type=\"fractalNoise\"\n baseFrequency={frequency}\n numOctaves={octaves}\n stitchTiles=\"stitch\"\n />\n <feColorMatrix type=\"saturate\" values=\"0\" />\n <feComponentTransfer>\n <feFuncR type=\"linear\" slope={slope} />\n <feFuncG type=\"linear\" slope={slope} />\n <feFuncB type=\"linear\" slope={slope} />\n </feComponentTransfer>\n </filter>\n <rect\n width=\"100%\"\n height=\"100%\"\n filter={`url(#${filterId})`}\n opacity={noiseOpacity}\n />\n </svg>\n )\n}\n",
1111
"type": "registry:ui"
1212
}
1313
]

apps/www/registry/example/noise-texture-demo-2.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ import { NoiseTexture } from "@/registry/magicui/noise-texture"
1313
export default function NoiseTextureDemo2() {
1414
return (
1515
<div className="flex justify-center p-4">
16-
<Card className="bg-card relative w-full max-w-md overflow-hidden border">
17-
<NoiseTexture />
16+
<Card className="bg-card/80 relative w-full max-w-md overflow-hidden border">
17+
<NoiseTexture noiseOpacity={0.45} />
1818
<CardHeader className="relative z-10 space-y-1 pb-4">
1919
<CardTitle className="text-xl">The weekly digest</CardTitle>
2020
<CardDescription>

apps/www/registry/example/noise-texture-demo-3.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@ export default function NoiseTextureDemo3() {
1010
variant="secondary"
1111
>
1212
<span className="relative z-10 font-medium">Subscribe</span>
13-
<NoiseTexture className="transition-all group-hover/button:opacity-100" />
13+
<NoiseTexture
14+
noiseOpacity={0.45}
15+
className="transition-all group-hover/button:opacity-100"
16+
/>
1417
</Button>
1518
</div>
1619
)

apps/www/registry/example/noise-texture-demo-4.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export default function NoiseTextureDemo4() {
99
Search with texture
1010
</Label>
1111
<div className="bg-muted/30 relative overflow-hidden rounded-lg border">
12-
<NoiseTexture />
12+
<NoiseTexture noiseOpacity={0.45} />
1313
<Input
1414
className="relative z-10 border-0 bg-transparent shadow-none focus-visible:ring-2"
1515
id="noise-input-demo"

0 commit comments

Comments
 (0)