Grainient
A grainy gradient: three colours flow through each other on a slowly warping field, under a heavy film grain that keeps it from banding. WebGL, written in the file.
- Category: Backgrounds
- Licence: Free, MIT
- Built with: React 19, Tailwind CSS 4, Motion
- Dependencies: motion, clsx, tailwind-merge
Examples
Grainient
API reference
| Prop | Type | Default | Description |
|---|---|---|---|
speed | number | 1 | 0 holds still. |
color / color2 / color3 | string | — | |
grain | number | 0.4 | |
warp | number | 1 | |
className | string | — |
About Grainient
Grainient blends three colours through each other on a slowly warping field, under a heavy film grain that keeps the gradient from banding. It is the textured gradient look, live and moving.
Grainient is an animated background for React 19, styled with Tailwind CSS 4 and animated with Motion. It drops into Next.js, Vite, Remix or Astro through the shadcn CLI as a single file you own.
When to use Grainient
- Hero and header backgrounds.
- Cards and feature panels.
- Album and podcast artwork.
- Brand pages that want warmth.
How it works
A warped noise field mixes your three colours, and fresh grain each frame hides banding on any display. The shader is written in the file, with no three.js or other dependency. It pauses when scrolled out of view, caps the pixel ratio at 2, re-reads your theme colours when the theme changes, and falls back to a soft gradient where WebGL is missing.
The whole layer is decorative and aria-hidden, sits behind your content without taking pointer events it does not need, and pauses when scrolled off screen. With prefers-reduced-motion on, it holds still or settles instantly instead of animating.
Customizing Grainient
Every prop is documented in the API reference above with its type and default. The ones you will reach for first are listed here.
The Customize panel next to the preview lets you change speed, grain, warp, color, color2 and more live, and the Code tab updates to match, so the snippet you copy already carries your values.
- speed (number, default 1): 0 holds still.
- color / color2 / color3 (string).
- grain (number, default 0.4).
- warp (number, default 1).
Goes well with Grainient
These backgrounds pieces share its tokens and motion language, so they sit together on one page without clashing.
- Dot Grid: An interactive React dot grid background whose dots swell near the pointer
- Grain: A React film grain overlay that removes gradient banding
- Hexagon Grid: A free React hexagon grid background that lights up under the cursor
- Ember Field: An animated React ember background: glowing embers drift up and flicker as they cool
- Smoke: A slow React smoke background: blurred plumes drifting over dark sections, CSS only
Install Grainient
npx shadcn@latest add https://charcoalui.com/r/grainient.jsonGrainient is free and MIT licensed. The command copies grainient.tsx into components/ui and installs clsx, tailwind-merge; you can also copy the source from the Code tab by hand.
Charcoal UI Pro adds 393 more showpiece components, 112 sections and 100 templates built the same way.
Frequently asked questions
- How do I install Grainient?
- Run npx shadcn@latest add https://charcoalui.com/r/grainient.json. The shadcn CLI copies grainient.tsx into components/ui and installs motion, clsx, tailwind-merge. You can also copy the source from this page by hand.
- Is Grainient free for commercial use?
- Yes. Grainient is MIT licensed: use it in any personal or commercial project and change it however you like.
- Does Grainient work with Next.js?
- Yes. It is a client component for React 19 styled with Tailwind CSS 4, so it works in the Next.js App Router and Pages Router, Vite, Remix and Astro.
- Can an AI coding agent install Grainient?
- Yes. Connect the Charcoal UI MCP server (https://charcoalui.com/mcp) to Claude Code, Cursor or any MCP client; get_component returns Grainient's props and source and get_install_command returns the exact command.