Skip to Content

Grain

Grain texture overlay in four treatments: plain noise, paper and sandpaper at overlay blend, and square at soft-light. Intensity steps from fine to rich or takes an exact opacity.

pnpm dlx shadcn add @01orbital/grain

The example also uses side-glow and subheading. Install them too:

pnpm dlx shadcn add @01orbital/side-glow @01orbital/subheading

Usage

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

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

export default function GrainDemo() {
  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 />
        <Grain />
        <div className="relative">
          <Subheading>{COPY.title}</Subheading>
          <p className="mt-3 text-sm/6">{COPY.body}</p>
        </div>
      </article>
    </div>
  )
}

Examples

New

grain-bakery-slip

grain-bakery-slip

Bakery Slip

Grain example: a bakery pickup slip on rich paper grain with an itemised order, a dashed collection window and a counter note. Shows the grain overlay on a receipt-style card.

pnpm dlx shadcn add @01orbital/grain-bakery-slip

API reference

A decorative grain layer that fills a positioned parent without blocking clicks. Choose a texture and adjust its strength with intensity or opacity. className and other div props land on the outer layer.

Prop

Type

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

Dependencies

npm: cn. The CLI installs them for you.

No other registry pieces.