Skip to content

NewMCP server for your coding agent. Set it up ›

Nexus UI
Get Pro

Throw Wheel, animated React component

  • Pro
  • 3D Components
  • 3D
  • Spring

Cards on a 3D drum you can fling. While it spins every card turns edge-on and blurs with speed, then they straighten one by one as the wheel snaps a card to the front.

Ticks as each card passes the front and drops softly when it settles on a card. Sound is off on this site until you switch it on.

Props

PropTypeDefaultWhat it does
cards—Each card has title, sub and art (any CSS background). Ten travel destinations by default.
count—How many cards go on the wheel, 3 up to the number of cards you pass. Defaults to all of them.
cardSize1Size of every card, 0.6 to 1.2. The wheel grows or shrinks with the cards.
glide1How far the wheel keeps gliding after a throw, 0.3 to 3. Higher glides further before it snaps to a card.
tilt1How far cards turn edge-on while the wheel spins, 0 to 2. 0 keeps every card flat.
blur1How much cards blur with speed, 0 to 2. 0 keeps them sharp.
autoplayfalseThrows the wheel every few seconds until someone grabs it.
enableSoundtruePlays interface sounds on interaction. They follow the sound switch (setSoundsEnabled, on by default) and stay silent on hover. Autoplay makes the same sounds once the visitor has used the page. Pass false to silence this component.

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

    Throw Wheel 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 Throw Wheel works

Cards on a drum you can throw. While it spins, each card turns edge-on in the one and the wheel snaps a card to the front.

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

Throw Wheel questions

How do I install Throw Wheel?

Run `npx shadcn@latest add @nexus-labs/throw-wheel`. It installs framer-motion. Throw Wheel 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 set the cards?

Pass `cards` as `{ title, sub, art }`. `art` is any CSS background, such as a gradient or `url(...)`. Without it you get ten travel destinations. The drum radius and card spacing are calculated from the number of cards, and each `title` is used as a key, so keep titles unique.

How do I spin it?

Drag sideways and let go to fling it; it coasts and snaps a card to the front. The Previous and Next buttons turn it one card. The drag area uses `touch-pan-y`, so vertical page scrolling still works on touch screens.

What is the blur and tilt effect?

While the wheel moves, each card turns edge-on in the direction of travel and blurs more with speed. Each card has its own spring stiffness, so they straighten one by one as the wheel slows.

Is it usable without dragging?

Yes. Previous and Next are labelled buttons, and a live region announces the front card's title. The wheel has a fixed "Destinations carousel" label. `autoplay` is off by default; when on it throws the wheel until someone grabs it.

Does it make sound, and how do I turn it off?

Ticks as each card passes the front and drops softly when it settles on a card. Sounds are synthesised with the Web Audio API, so there are no audio files, and they only play after a click or key press. Pass `enableSound={false}` to silence this component, or call `setSoundsEnabled(false)` from `@/lib/ui-sounds` to switch every sound off at once. The CLI installs `@/lib/ui-sounds` with the component.