Drape Background - React Component | Kokonut UI
Drape Background
A pleated curtain in a breeze that you can push and pull, built with React, WebGL and a cloth simulation.
Install with
npx shadcn@latest add https://kokonutui.com/r/drape-background.json
no extra packages
Behind the curtain
A pleated curtain in a light breeze. Sweep the cursor through it, or grab a fold and pull.
Installation
Drape Background is a free, open-source React component in the Kokonut UI Backgrounds collection. Add it with the shadcn CLI, which copies the source into components/kokonutui/drape-background.tsx, so the code is yours to change.
npx shadcn@latest add @kokonutui/drape-background
Usage
import DrapeBackground from "@/components/kokonutui/drape-background";
export default function Example() {
return <DrapeBackground />;
}
Props
className:string- Extra classes for the root element.children:ReactNode- Content shown over the curtain. Passnullfor a bare background.wind:number(Default1) - Strength of the breeze. 0 lets the curtain hang still.pleat:number(Default34) - Depth of the pleats along the top, in px.interactive:boolean(Defaulttrue) - Push the fabric with the cursor and grab it to drag it around.
Dependencies
| Needs | Version | Comes from |
|---|---|---|
cn from lib/utils.ts |
shadcn init | |
| React | 19 |
Your app |
| Tailwind CSS | 4 |
Your app |
No provider, font or global CSS to set up: the file works as soon as it lands.