Introducing Nyx UI v1.2.0

Animated Grainy Background

A dynamic animated gradient background component that supports various grainy effects and patterns.

Animation Types

flow

Animation Pattern

mesh

Animation Pattern

waves

Animation Pattern

aurora

Animation Pattern

spiral

Animation Pattern

pulse

Animation Pattern

Grain Types

digital

Grain Texture

plasma

Grain Texture

scratches

Grain Texture

paper

Grain Texture

noise

Grain Texture

dust

Grain Texture

Installation

Usage

import { AnimatedGrainyBg } from "@/components/ui/animated-grainy-bg";
<div className="relative h-[500px] w-full overflow-hidden bg-transparent">
  <div className="absolute inset-0">
    <AnimatedGrainyBg
      position="absolute"
      colors={["#3b82f6", "#2563eb", "#1d4ed8", "#1e40af"]}
    />
  </div>
  <div className="relative z-10 flex h-full items-center justify-center text-white">
    <div className="p-4 text-center">Animated Background</div>
  </div>
</div>

Props

PropTypeDefaultDescription
childrenReact.ReactNodeundefinedContent to render on top of the gradient background.
classNamestring""Additional CSS classes to apply to the container.
styleReact.CSSPropertiesundefinedInline styles to apply to the container.
colorsstring[]Auto-selected based on darkModeArray of colors to use in the gradient pattern.
speednumber1Speed factor for the gradient animation (higher = faster).
grainTypestring"digital"Type of grain texture effect: digital (sharp pixelated), plasma (organic flowing), scratches (linear streaks), paper (smooth textured), noise (fine random), dust (scattered particles).
grainIntensitynumber60Intensity of the grain effect (0-100).
grainSizenumber100Size of the grain particles.
animationTypestring"mesh"Animation pattern effect: flow (smooth directional), mesh (interconnected nodes), waves (rhythmic undulation), aurora (curtain-like movement), spiral (circular rotation), pulse (concentric expansion).
size"sm" | "md" | "lg" | "full" | number"full"Size of the background container. Numbers represent pixels.
positionstring"relative"CSS position property for the background container.
zIndexnumber0z-index of the background container.
animatebooleantrueEnable or disable background animation.
darkModebooleanfalseEnable dark mode styling and default colors.
asstring"div"HTML element to render as the container.
grainBlendModestring"soft-light"CSS blend mode effect for grain layer: multiply (darkens), overlay (contrast), soft-light (gentle), hard-light (intense), screen (brightens), color-burn (dramatic), normal (standard).