Skip to content

NewMCP server for your coding agent. Set it up ›

Nexus UI
Get Pro

Slide to Confirm, animated React component

A slide-to-confirm track for payments and other deliberate actions. The knob stretches along the track in proportion to how fast you drag it and squashes back when it stops, the label shimmers and fades as you pull, and past the threshold the track floods with the success colour while a check draws itself. Also includes Slide to Pay, a payment you confirm by sliding: the track pulls in to a circle under your thumb, spins while it sends and turns into a tick.

  • Pro
  • Inputs & Controls
  • Spring

Ticks softly as the knob passes each quarter of the track, chimes on confirm and bumps if the confirm fails. The Slide to Pay variant ticks softly as you use it, chimes on the key moments and whooshes on the bigger moves. Sound is off on this site until you switch it on.

Slide to Confirm

Slide to Pay

Props

PropTypeDefaultWhat it does
label"Slide to confirm"Text inside the track before confirming.
successLabel"Confirmed"Text shown once confirmed.
pendingLabel"Confirming"Text shown while onConfirm is pending.
onConfirm—Runs when the knob reaches the end. Return a promise to show a pending state; reject to bounce back.
threshold0.9How far (0-1) the knob must travel before letting go confirms.
resetAfter2200Return to the start this many ms after success; 0 keeps the success state.
accent—Colour of the trail and the arrow. Defaults to system blue.
successColor"#248a3d"Track colour once confirmed.
size"md"Track height and default width.
width—Track width in px. Defaults per size (260, 300, 340).
autoplayfalseSlides itself across and confirms (without calling onConfirm) until someone touches it.
disabledfalseDims the track and ignores input.
SlideToPay.payee"Emily Parker"Name of the person being paid.
SlideToPay.note"Concert tickets"Short note shown under the payee.
SlideToPay.amount240Amount being paid.
SlideToPay.currency"$"Currency symbol shown before amounts.
SlideToPay.from"Everyday debit 4821"Account the money leaves.
SlideToPay.arrives"Instantly"When the payment arrives.
SlideToPay.onSend—called when the slide completes; resolve when the payment is done
SlideToPay.enableSoundtrueSoft synthesised sounds as you use it. They also follow the site-wide sound switch.
SlideToPay.volume0.6Sound level, 0 to 1.
SlideToPay.autoplayfalsePlays a short demo by itself until the visitor touches it. Never runs under reduced motion.
SlideToPay.className""Extra classes for the outer element.
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

    Slide to Confirm 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 Slide to Confirm works

A slide-to-confirm track. The knob is rubbery: it stretches along the track in proportion to how fast you drag it and squashes back when it stops. A trail fills behind it, the label shimmers and fades as you pull, and on release past the threshold the track floods with the success colour while a check draws itself.

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

Slide to Confirm questions

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

Ticks softly as the knob passes each quarter of the track, chimes on confirm and bumps if the confirm fails. The Slide to Pay variant ticks softly as you use it, chimes on the key moments and whooshes on the bigger moves. 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.