Skip to content

NewMCP server for your coding agent. Set it up ›

Nexus UI
Get Pro

Fold Note, animated React component

  • Pro
  • Cards
  • 3D
  • Spring

A printed credit note you fold on its centre crease. Drag the right half over and it turns in 3D, shading as it goes and showing its patterned back; past halfway it snaps shut with a bounce, and a tap opens it again.

Props

PropTypeDefaultWhat it does
title"Store Credit"Small caps heading printed top left.
amount"50"Denomination printed top right and, smaller, bottom right.
serial"NOT LEGAL TENDER · SC 000042"Fine print along the bottom edge.
backLabel"Thanks"Word printed on the back of the folding half.
onFoldChangeundefinedCalled with true when the note snaps shut and false when it opens.
autoplayfalseFolds and unfolds every two seconds until the user grabs or taps it.

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

    Fold Note 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 Fold Note works

A credit note you can fold. Grab the right half and drag it over: it turns on the centre crease in 3D, shading as it goes, and shows its printed back.

The source, the install command and the build prompt come with Pro.

Fold Note questions

How do I install Fold Note?

Run `npx shadcn@latest add @nexus-labs/fold-note`. It installs framer-motion. Fold Note 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 on the note?

Use `title` (default "Store Credit"), `amount` (a string, default "50", printed as given), `serial` for the fine print, and `backLabel` (default "Thanks") for the word on the back of the folding half.

How do I know when it has folded?

Pass `onFoldChange`. It is called with `true` when the note snaps shut and `false` when it opens again, including when autoplay folds it. Both arguments are booleans.

How do I fold it, and does it work with a keyboard?

Drag the right half over: past halfway, or with a fast leftward flick, it snaps shut with a bounce; otherwise it opens back. A tap toggles it. It is focusable, and Space toggles it.

How is the 3D fold made, and can I recolour the note?

It uses CSS `perspective` and a `rotateY` turn on the centre crease, with a dark overlay for shading and `backfaceVisibility` to show the back. The colours and size are constants in the source, not props.