Skip to Content

Soft Grain

Soft grain texture: a five-octave fractal noise tile at overlay blend and very low opacity, giving a dark ground a gentle tooth. Three intensities from fine to rich.

Installation

pnpm dlx shadcn@latest add @01orbital/soft-grain

Usage

import { SideGlow } from "@/components/glow/side-glow"
import { Subheading } from "@/components/subheading/subheading"
import { SoftGrain } from "@/components/texture/soft-grain"

const COPY = {
  title: "Night notes",
  body: "Written after sundown.",
} as const

export default function SoftGrainDemo() {
  return (
    <div className="flex min-h-full w-full flex-1 items-center justify-center p-6">
      <article className="relative isolate flex aspect-4/3 w-full max-w-96 flex-col justify-end overflow-hidden rounded-3xl bg-[oklch(0.372_0.044_257.3)] p-8 text-scene-foreground">
        <SideGlow />
        <SoftGrain intensity="rich" />
        <div className="relative">
          <Subheading>{COPY.title}</Subheading>
          <p className="mt-3 text-sm/6">{COPY.body}</p>
        </div>
      </article>
    </div>
  )
}

This example installs with everything it uses:

pnpm dlx shadcn@latest add @01orbital/soft-grain-demo

Examples

Claysoft-grain-clay

Soft Grain Clay: an example of soft-grain.

pnpm dlx shadcn@latest add @01orbital/soft-grain-clay

Inksoft-grain-ink

Soft Grain Ink: an example of soft-grain.

pnpm dlx shadcn@latest add @01orbital/soft-grain-ink

API reference

Soft overlay noise from an SVG turbulence filter, in a 512px tile. The parent needs relative.

Prop

Type

It also accepts the HTML attributes of the element it renders.

Dependencies

npm: cn. The CLI installs it for you.

Used in blocks

3 blocks are built with Soft Grain:

Last updated on