Modus UI

Silk Mesh

Web (React)

A soft flowing mesh gradient in your theme colours with grain and noise texture.

A drifting mesh gradient whose colours default to your theme's background and primary tokens, textured with soft-light noise and film grain. Colours update when the theme changes. It fills its positioned parent and freezes its animation when the user prefers reduced motion. Built on the shaders library (MIT) and rendered with WebGPU.

Silk Mesh

Installation

CLI

npx @modus-ui/cli add silk-mesh

Manual

  1. Install shaders with npm install shaders.
  2. Copy the code from the component tab.
  3. Create a file at components/ui/silk-mesh.tsx.
  4. Paste the code.

Usage

tsx
import { SilkMesh } from "@/components/ui/silk-mesh";

export default function Example() {
  return (
    <div className="relative h-[500px] w-full overflow-hidden">
      <SilkMesh />
      <div className="relative z-10 p-8">
        <h1>Content over the effect</h1>
      </div>
    </div>
  );
}

Props

PropTypeDefaultDescription
colorAstringtheme tokenFirst colour. Defaults to the --background token.
colorBstringtheme tokenSecond colour. Defaults to the --primary token.
speednumber0.6Drift speed.
countnumber4Number of colour swaths.
swirlnumber0.5Amount of swirl in the swaths.
smoothnessnumber0.6Softness of the seams between swaths.
grainnumber0.06Film grain strength.

Comments

  • No comments yet.