npx shadcn@latest add https://components.bksh.site/r/paper.json

UI

Paper

A GPU paper surface — fibres, crumples, folds, and grain. Run it over a photo, or on its own.

Example.tsx
import { Paper } from "@/components/better/paper"
export function Example() {
return (
<Paper
image="/photo.jpg"
color="#f4efe4"
colorFront="#9fadbc"
contrast={0.3}
roughness={0.4}
fiber={0.3}
fiberSize={0.2}
crumples={0.3}
crumpleSize={0.35}
folds={0.65}
foldCount={5}
drops={0.2}
fade={0}
seed={6}
radius={16}
className="aspect-[4/3] w-full max-w-xl"
/>
)
}

Dependencies

Props

PropTypeDefaultDescription
childrenReactNode
classNamestring
imagestringOptional source image. With one, the texture becomes a filter over the photo (creased, printed-on-paper look); without one, it's a plain paper surface in `color` / `colorFront`. /
colorstring"#f4efe4"Base paper colour (the "back" of the texture).
colorFrontstring"#9fadbc"Colour of the texture's ink/shadow detail.
contrastnumber0.3Sharpness of the light-to-dark transitions, 0–1.
roughnessnumber0.4Fine pixel grain, 0–1.
fibernumber0.3Curly fibre noise, 0–1.
fiberSizenumber0.2Scale of the fibre noise, 0–1.
crumplesnumber0.3Cell-based crumple intensity, 0–1.
crumpleSizenumber0.35Scale of the crumple cells, 0–1.
foldsnumber0.65Depth of the folds, 0–1.
foldCountnumber5How many folds, 1–15.
fadenumber0Large-scale noise mask over the whole pattern, 0–1.
dropsnumber0.2Speckles, 0–1.
seednumber5.8Changes the random layout of folds, crumples, and drops. 0–1000.
radiusnumber16Corner radius in px.