Skip to content

NewMCP server for your coding agent. Set it up ›

Nexus UI
Get Pro

Cloth Banner, animated React component

  • Pro
  • CTA Sections

An announcement printed on cloth and pinned to a rail by five pins. It sways in the breeze and drapes under your hand; yank it down hard and the pins pop one by one until it drops away, or press Dismiss to let it fall.

Props

PropTypeDefaultWhat it does
title"Launch Week"Big line printed on the cloth.
subtitle"Oct 27–31 · five drops, one a day"Smaller line printed under the title.
from"#0071e3"Gradient start colour of the cloth (top left).
to"#5e5ce6"Gradient end colour of the cloth (bottom right).
onDismiss—Called once the banner has dropped away, whether it was yanked down or dismissed with the button.
autoplayfalseSends 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. 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 creates components.json and the cn() helper in src/lib/utils.ts:

    npx shadcn@latest init -d

    Starting from nothing? The Quick Start walks through the whole thing.

  2. 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:

    1. Create a key at nexus-ui.com/dashboard/api-key. Copy it straight away: it starts with nxs_ and is shown only once.
    2. In your project root, next to package.json, create a file named .env.local with this line, using your own key:
      NEXUS_API_KEY=nxs_your_key_here
    3. Open components.json and 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}"
          }
        }
      }

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.