Grain

A paper grain that gives flat surfaces some texture.

Issue 04

Paper and ink

Installation#

pnpm dlx shadcn@latest add @balick/grain

Or pass the full URL: https://ui.balick.me/r/grain.json

Usage#

import { Grain } from "@/components/ui/grain"

export function Card() {
  return (
    <div className="relative overflow-hidden rounded-xl bg-card p-6">
      <Grain />
      <p className="relative">Paper and ink</p>
    </div>
  )
}

Props#

PropTypeDefault
frequency

Fineness of the grain: higher values give smaller specks.

number0.8
octaves

Number of noise layers: more layers give a richer texture.

number3
className

A text-* class sets the color of the specks; opacity-* how much they show (20% by default).

string—