Skip to content

NewMCP server for your coding agent. Set it up ›

Nexus UI
Get Pro

Bend Text, animated React component

  • Pro
  • Motion Effects
  • Spring

A line of type running along a string that you can grab and pull, with the words flowing round the bend. Let go and an underdamped spring twangs it back, overshooting a few times before it lies flat.

Props

PropTypeDefaultWhat it does
text"PLUCK THE LINE · MAKE IT SING · "One repeat of the text on the string; it is repeated four times so the line stays full.
accent"#0071e3"Colour of the grab point and the focus ring.
hint"Grab the line, pull, and let go."Caption under the stage. An empty string hides it.
onPluck—Called on release with how far the string was pulled from rest, in stage units.
autoplayfalsePlucks the string every 2.6s until someone touches it.
className—Extra classes for the root element.

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

    Bend Text 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 Bend Text works

pull, and the string bends under your hand with the words flowing round the curve. Let go and it twangs back, overshooting a few times before it lies flat again.

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

Bend Text questions

How do I install Bend Text?

Run `npx shadcn@latest add @nexus-labs/bend-text`. 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 on the string?

Pass `text` as one repeat of the line; it is repeated four times along an SVG `textPath` and drifts slowly along the string. The default ends with a separator and a space so repeats do not run together. With reduced motion on, the drift stops.

Can I change the color and the caption?

`accent` (default `#0071e3`) colors the grab point and the focus ring. `hint` is the caption under the stage; pass an empty string to hide it. The text color follows light and dark mode through the `dark:` classes.

How do I react when the string is plucked?

Pass `onPluck`. It is called on release with how far the string was pulled from rest, in stage units, so you can trigger something on a big pull. Keyboard plucks call it too.

Can I pluck it with the keyboard?

Yes. The stage is focusable with `role="button"`. Enter, Space and ArrowUp pluck it upward, ArrowDown pulls it down, and ArrowLeft and ArrowRight pluck from other points on the string. The spring is underdamped, so it overshoots a few times before settling.