# Grain Gradient

> Colour that folds slowly like silk, finished with film grain.

## Spec sheet

| | |
| --- | --- |
| Access | Free: no account, free for commercial use |
| Shelf | Backgrounds › Backgrounds |
| Live preview | https://uibrik.com/components/grain-gradient |
| Writes | 1 files into `components/uibrik/grain-gradient/`, plus `components/uibrik/_shader-background/ShaderSurface.tsx` |
| Packages | none beyond React |
| Needs | React 19, Tailwind CSS v4, a project set up with `npx shadcn@latest init` |
| Theme | Reads the shadcn tokens and follows class-based dark mode ([theming](https://uibrik.com/docs/theming.md)) |
| Updated | Nov 12, 2026 |

## Add it

```bash
npx shadcn@latest add https://uibrik.com/r/grain-gradient.json
```

With the `@uibrik` namespace in `components.json` ([setup](https://uibrik.com/docs/installation.md)): `npx shadcn@latest add @uibrik/grain-gradient`.

Can't run commands? https://uibrik.com/components/grain-gradient/prompt-full.txt has every file verbatim, with the setup steps, ready for an assistant to write.

## Render it

Renders as is; every value shown is the default, so delete any line you don't need.

```tsx
import { GrainGradient } from "@/components/uibrik/grain-gradient/grain-gradient";

const colors = ["#07142e", "#123a7c", "#2b6bd6", "#7db4f2", "#dcebfc"];

<GrainGradient
  colors={colors}
  scale={1}
  warp={1}
  sheen={0.6}
  angle={30}
  sweep={0.7}
  vignette={0.5}
  speed={1}
  grain={0.08}
  grainSize={1}
  seed={0}
  interactive
  twist={1}
  animate
>
  …
</GrainGradient>
```

## Tune it

The same props as the Customize panel on https://uibrik.com/components/grain-gradient.

| Prop | Type | Default | What it does |
| --- | --- | --- | --- |
| `colors` | `string[]` | `["#07142e","#123a7c","#2b6bd6","#7db4f2","#dcebfc"]` | Hex colours, 2 to 6, laid out from first to last across the flow. |
| `scale` | `number` | `1` | Size of the shapes; larger is calmer. |
| `warp` | `number` | `1` | How much the flow folds into itself. |
| `sheen` | `number` | `0.6` | Soft light on the folds. |
| `angle` | `number` | `30` | Direction the colours run; 0 is left to right. |
| `sweep` | `number` | `0.7` | How far apart the first and last colours sit; 0 mixes them all evenly. |
| `vignette` | `number` | `0.5` | Darkening toward the corners. |
| `speed` | `number` | `1` | Animation speed; 1 is the designed pace. |
| `grain` | `number` | `0.08` | Film grain strength. |
| `grainSize` | `number` | `1` | Size of a grain speck. |
| `seed` | `number` | `0` | Shifts the composition, so two backgrounds with the same settings still differ. |
| `interactive` | `boolean` | `true` | Twist the silk with the pointer. |
| `twist` | `number` | `1` | How strongly the pointer twists the silk. |
| `animate` | `boolean` | `true` | Move on its own. Off draws one still frame. |

## Wire it

The props the Customize panel doesn't show: ranges, data, content and callbacks.

| Prop | Type | Default | What it does |
| --- | --- | --- | --- |
| `children` | `ReactNode` |  | Content shown on top of the background. |
| `className` | `string` |  | Classes for the box; it fills whatever size you give it. |

## Where it fits

- **Warm hero backgrounds**: Colour folding like silk with film grain adds warmth behind a headline. Pairs with [Mesh Gradient](https://uibrik.com/components/mesh-gradient.md) (Pro).
- **Campaign pages**: A slow shifting gradient in brand shades gives seasonal pages a premium finish.
- **Music and fashion sites**: Grain gives the gradient a printed, analogue texture suited to creative brands. Pairs with [Oil Slick](https://uibrik.com/components/oil-slick.md) (Pro).

## Same shelf: Backgrounds

- [Halftone](https://uibrik.com/components/halftone.md): A screen of lit dots: swirling ribbons of light drawn by the size and brightness of each dot.
- [Halftone Horizon](https://uibrik.com/components/halftone-horizon.md) (Pro): An arched horizon printed in halftone in the dark, where the dots grow with the light until they fuse into a smooth glow.
- [Horizon Gradient](https://uibrik.com/components/horizon-gradient.md): Black fading through deep blue to white in bands that arch like a horizon, breathing slowly.
- [Ice Tiles](https://uibrik.com/components/ice-tiles.md) (Pro): Soft blobs of colour seen through a wall of frosted ice cubes, stepping from cube to cube.
- [Ink Plume](https://uibrik.com/components/ink-plume.md) (Pro): A soft plume of black ink rising through white, split at its edges into ultramarine and vermilion, spreading to a haze as it climbs.
- [LED Field](https://uibrik.com/components/led-field.md) (Pro): A dark panel of tiny lights where clusters of glowing pixels drift and blink slowly, and the pointer leaves a trail of lit cells that blink back off.

## Ground rules

- Only the props above exist. To change anything else, edit the installed file.
- Keep the files in `components/uibrik/grain-gradient/` so the import paths keep resolving.
- The playbook for working with the whole library: https://uibrik.com/llms.txt
