Cloth Banner, animated React component
- Pro
- CTA Sections
Props
| Prop | Type | Default | What it does |
|---|---|---|---|
| title | string | "Launch Week" | Big line printed on the cloth. |
| subtitle | string | "Oct 27–31 · five drops, one a day" | Smaller line printed under the title. |
| from | string | "#0071e3" | Gradient start colour of the cloth (top left). |
| to | string | "#5e5ce6" | Gradient end colour of the cloth (bottom right). |
| onDismiss | () => void | — | Called once the banner has dropped away, whether it was yanked down or dismissed with the button. |
| autoplay | boolean | false | Sends a gust of wind every 2.2s until someone grabs the cloth or presses a button. Off when reduced motion is preferred. |
Add it to your project
- 1
Set up your project once
You need a Next.js project with Tailwind CSS and the
@/import alias. In its root folder, run this once. It createscomponents.jsonand thecn()helper insrc/lib/utils.ts:npx shadcn@latest init -d
Starting from nothing? The Quick Start walks through the whole thing.
- 2
Connect the registry with your API key
Cloth Banner is a Pro item, so the CLI has to send your API key. Do this once per project:
- Create a key at nexus-ui.com/dashboard/api-key. Copy it straight away: it starts with
nxs_and is shown only once. - In your project root, next to
package.json, create a file named.env.localwith this line, using your own key:NEXUS_API_KEY=nxs_your_key_here
- Open
components.jsonand add this entry inside the outermost braces, next to"aliases". Leave{name}and${NEXUS_API_KEY}exactly as written; the CLI fills them in:"registries": { "@nexus-labs": { "url": "https://www.nexus-ui.com/api/registry/{name}", "headers": { "Authorization": "Bearer ${NEXUS_API_KEY}" } } }
- Create a key at nexus-ui.com/dashboard/api-key. Copy it straight away: it starts with
How Cloth Banner works
A launch announcement printed on real cloth, hung from a rail by five your hand. Yank it down hard enough and the pins pop one by one until the banner drops away. That is how you dismiss it (or with the Dismiss button).
The source, the install command and the build prompt come with Pro.
Cloth Banner questions
How do I install Cloth Banner?
Run `npx shadcn@latest add @nexus-labs/cloth-banner`. It adds the component and installs framer-motion. It is a Pro component, so it needs a Pro plan and an API key; key setup is on the CLI docs page (/docs/cli).
How do I change the text and colors?
`title` (default "Launch Week") and `subtitle` are painted onto the cloth as one line each. `from` (default `#0071e3`) and `to` (default `#5e5ce6`) set the gradient from top left to bottom right.
How do I know when the banner was dismissed?
Pass `onDismiss`. It is called once the banner has dropped away, whether it was yanked down or the Dismiss button was pressed. The component does not remember the choice, so store it yourself, for example in localStorage.
Is it a physics library?
No. The cloth is a small simulation inside the component, drawn on a 2D canvas with five pins holding it to the rail. Framer Motion only animates the "dismissed" message and button, so framer-motion is the one dependency.
How does it work without a mouse or with reduced motion?
Dragging needs a pointer, but Dismiss, Breeze and Hang it back up are real buttons. With prefers-reduced-motion, the ambient sway is off and `autoplay` does nothing; gravity, grabbing and the Breeze button still work.

