Slide to confirm
A track with a knob you drag to the end to confirm a costly step on a touch screen (submit grades, send a payment). The knob follows your finger 1:1, resists past the ends, and commits past 85 % of the way.
Usage
Use it when
- A costly, deliberate confirm on a phone or tablet where a stray tap must not trigger it: submit final grades, pay a fee, send an exam for marking.
- The last step of a flow, at the bottom of the screen within thumb reach.
Use something else when
- Desktop with a mouse as the main input: use Hold to confirm. Dragging a knob with a mouse is slow; holding a button is not.
- Destroying shared or unrecoverable data: use Alert dialog.
- An action that can be undone: use Button. Do it at once and offer Undo in a toast.
- Picking a value along a range: use Slider.
Where it goes. At the bottom of a phone screen or sheet, full width of the content column (it caps at 340 px and shrinks to fit). One per screen, with the summary of what is being confirmed directly above it.
Examples
<div class="slide" data-lds-slide id="submit-grades">
<span class="slide__fill" aria-hidden="true"></span>
<span class="slide__label" aria-live="polite">Slide to submit grades</span>
<button class="slide__knob" aria-label="Slide to submit grades. Press Enter to confirm."><span class="ic" aria-hidden="true">arrow_forward</span></button>
</div>
<script type="module">
const s = document.getElementById('submit-grades');
s.addEventListener('lds:confirm', () => { s.querySelector('.slide__label').textContent = 'Grades submitted'; sendGrades(); });
</script>- Exam fee
- Rp 150.000
- Paid from
- Campus wallet
- Exam fee
- Rp 150.000
- Paid from
- Campus wallet
<div class="stack" style="--gap: 16px; max-width: 360px;">
<dl class="kv-list" style="margin: 0;">
<div class="kv"><dt>Exam fee</dt><dd>Rp 150.000</dd></div>
<div class="kv"><dt>Paid from</dt><dd>Campus wallet</dd></div>
</dl>
<div class="slide" data-lds-slide>
<span class="slide__fill" aria-hidden="true"></span>
<span class="slide__label" aria-live="polite">Slide to pay Rp 150.000</span>
<button class="slide__knob" aria-label="Slide to pay Rp 150.000. Press Enter to confirm." onpointerenter="const s = this.closest('.slide'); if (!s.dataset.wired) { s.dataset.wired = '1'; s.addEventListener('lds:confirm', () => { s.querySelector('.slide__label').textContent = 'Payment sent'; }); }" onfocus="const s = this.closest('.slide'); if (!s.dataset.wired) { s.dataset.wired = '1'; s.addEventListener('lds:confirm', () => { s.querySelector('.slide__label').textContent = 'Payment sent'; }); }"><span class="ic" aria-hidden="true">arrow_forward</span></button>
</div>
</div>Anatomy
| Part | What it is |
|---|---|
.slide[data-lds-slide] | Required. The 56 px track, pill shaped, on --bg-recessed. |
.slide__fill | Required. The accent-tinted trail that grows behind the knob. |
.slide__label | Required. The instruction ("Slide to submit grades"); fades as the knob passes it. Change its text to the result after confirm. |
.slide__knob | Required. A <button> 48 px, accent, with an arrow_forward icon that becomes check when done. Needs an aria-label. |
States
| State | How |
|---|---|
rest | Knob at the start, label visible. |
.is-dragging | While the pointer holds the knob; cursor is grabbing. |
released short | Knob returns on --spring-momentum over --d-momentum. |
.is-done | Track turns --success-tint, label --success-text and semibold, knob green with a check. lds:confirm fires. There is no built-in reset. |
Motion and microinteractions
- Drag: the knob follows the pointer 1:1 (no transition) and the fill grows with it; the label fades out over the first 60 % of travel.
- Past either end it rubber-bands (
over * 52 * 0.55 / (52 + 0.55 * |over|)), so it resists instead of stopping dead. - Release: the end point is projected from the last 5 pointer samples; past 85 % of travel it commits and slides to the end on
--spring-smoothover--d-smooth, otherwise it returns on--spring-momentum(the one place a slight overshoot is earned, after a gesture). - Done: track and knob colors cross-fade over
--d-standard; the label padding moves on--spring-smooth. - Under reduced motion transitions shorten to 120 ms; the drag itself still follows the finger.
Accessibility
- The knob is a
<button>: Tab reaches it and Enter confirms at once. Say so in itsaria-label. - Put
aria-live="polite"on.slide__labelso the result ("Grades submitted") is announced when you change it. - The drag is not the only path: Enter works, and for switch or voice users provide another route (a confirm button in settings).
- Contrast: the label is
--text-subtleon--bg-recessed; the done label is--success-texton--success-tint.
Do and don't
Do
- Say what will happen in the label ("Slide to pay Rp 150.000").
- Change the label to the result after
lds:confirm. - Keep it within thumb reach at the bottom of the screen.
Don't
- Use it on desktop-first screens.
- Put two on one screen.
- Use it for reversible, everyday actions.
Behavior and code
Plain HTML. data-lds-slide on the track. init() handles pointer drag with rubber-banding and velocity projection, commits past 85 %, sets .is-done, swaps the knob icon to check, and dispatches lds:confirm on the track. Enter on the knob commits.