Slide to payPaid

Code

<!-- tide-slide.free.js: download it from the Install section below and host it with your site -->
<script src="/tide-slide.free.js" defer></script>

<tide-slide
  label="Slide to pay"
  done-label="Paid"
  width="340"
  size="60"
  theme="light"
  reset-after="3"
></tide-slide>

<script>
  document.querySelector('tide-slide').addEventListener('confirm', () => {
    // charge the card, send the transfer…
  });
</script>

In context

Oat flat white × 2$9.00
Total$9.00
Slide to payPaid
Checkout
Slide to send $250Sent
Slide to unlockUnlocked
Send and unlock, Ember and Mint Pro

Install · Free Web Component

One file, no dependencies. Lagoon preset, every other option included. Host it yourself so your visitors never load anything from our servers.

1. Install with one command — or download the file
shadcn CLI · React
npx shadcn@latest add https://www.ui-design.co/r/tide-slide.json
2. Load it and use the element
HTML
<!-- tide-slide.free.js: download it from the Install section below and host it with your site -->
<script src="/tide-slide.free.js" defer></script>

<tide-slide
  label="Slide to pay"
  done-label="Paid"
  width="300"
  size="56"
  theme="light"
></tide-slide>

<script>
  document.querySelector('tide-slide').addEventListener('confirm', () => {
    // charge the card, send the transfer…
  });
</script>
3. React + TypeScript (optional)

The shadcn command adds a typed React wrapper for you. Using the file directly? Custom elements work in React as-is; for type checking add:

TypeScript
// tide-slide.d.ts
declare namespace JSX {
  interface IntrinsicElements {
    'tide-slide': React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement> & {
      label?: string;
      'done-label'?: string;
      width?: number | string;
      size?: number | string;
      theme?: 'light' | 'dark';
      'reset-after'?: number | string;
      confirmed?: boolean | '';
      disabled?: boolean | '';
      sound?: boolean | '';
    };
  }
}

Pro · React + TypeScript Pro

One payment of $4.99, yours forever. Use it in unlimited personal and commercial projects; no resale.

  • React component with TypeScript types (onConfirm, onReset, controlled confirmed) and the full source
  • Ember, Mint and Mono tints, plus your own three colours as a custom tint
  • The vanilla Web Component with every tint, a demo page, README and license

Attributes & props

NameTypeDefaultDescription
label string'Slide to confirm'Text in the tube. Also the accessible name.
done-label string'Confirmed'Text once confirmed. doneLabel in React.
width number (px)300Width of the tube. In React you can also set any CSS width through style.
size number (px)56Height; the bead and the text scale with it.
theme 'light' | 'dark''light'A light porcelain groove or a dark one.
reset-after number (s)0Goes back to the start by itself after this many seconds and fires reset. 0 keeps it confirmed. resetAfter in React.
confirmed booleanoffSet by the component when confirmed. Remove it (or call reset()) to start over; add it to show the confirmed state.
disabled booleanoffDims it and ignores input.
sound booleanoffSoft ticks as the bead slides and a glass chime on confirm (plus a tap of vibration on phones). Also on for everything inside an element with data-ui-sound="on".
tint Pro'lagoon' | 'ember' | 'mint' | 'mono' | object'lagoon'Colours of the liquid, or a custom { colors: [a, b, c] }. Free build ships Lagoon only.

It fires confirm once, when the bead passes 90% of the way on release or touches the end. Only the bead can be dragged, so a stray tap on the tube does nothing — that is the point of the control. From the keyboard, Enter or Space confirms and the arrow keys move the bead. For an irreversible action still confirm on the server: the gesture guards against accidents, not against intent. The liquid is drawn on a small 2D canvas (no WebGL), pauses off-screen, and with reduced motion it moves only while you drag.

More components