Skip to content

NewMCP server for your coding agent. Set it up ›

Nexus UI
Get Pro

Page Curl, animated React component

  • Pro
  • Cards
  • Spring

Grab the corner of a page and peel it back. The fold is computed live from your pointer, the flap shows the paper's back, and whatever you put underneath is revealed.

Props

PropTypeDefaultWhat it does
width400Page width in px.
height260Page height in px.
frontsample letterContent of the page you peel.
backhidden discount cardWhat is revealed underneath the page.
autoplayfalsePeeks the corner by itself until someone grabs 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

    Page Curl 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 Page Curl works

A page you peel from the corner. The fold line is the perpendicular bisector between the corner and your pointer: the page is clipped on one side of it, and the folded flap is the corner region mirrored across it, shaded as the

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

Page Curl questions

How do I install the Page Curl component?

Run `npx shadcn@latest add @nexus-labs/page-curl`. It installs framer-motion, and the fold is plain DOM, so there is no canvas, WebGL or image library. 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 put my own content on the page and underneath it?

Pass any React nodes as `front` (the page you peel) and `back` (what is revealed), and size the page with `width` (default 400) and `height` (default 260) in px. Without them it shows a sample letter over a discount card.

How is the page curl effect built?

The fold line is the perpendicular bisector between the bottom-right corner and your pointer. The page is cut along it with a `clip-path` polygon, and the flap is the cut-off corner mirrored across the line, shaded as the back of the paper. Because it is clip-path, the front and back can be any HTML.

What happens when I let go, and can I peel it with the keyboard?

If the corner is dragged past about 60% of the page diagonal it peels all the way off; otherwise it springs back flat. The corner handle is a button, and pressing Enter or Space on it peels the page off, after which a "Put it back" button restores it. Only the bottom-right corner can be grabbed.