SwipeUI

Slide to confirm

A measured directional confirmation track with detents, elastic release and async outcomes.

npx @swipeui/cli add slide-to-confirm
Variant
Preset
Material
Scheme
Feel
Interactive web demo. Native materials, gestures and system presentation differ on device.

When to use it

  • Require a deliberate directional gesture for a clearly explained action.
  • Provide a compact confirmation with accessible activation as an alternative.

When not to use it

  • Use a drag as the only accessible route to a critical action.
  • Infer physical gesture reliability from mocked callbacks.

Installation

Installs with a Pro licence

Everything on this page is public except the source. Founder pre-sale opens around 5 January 2027.

Usage

app/actions.tsx
import { SlideToConfirm } from '@/components/swipeui/ui/slide-to-confirm';

<SlideToConfirm
  onConfirm={archiveDraft}
  labels={{ idle: 'Slide to archive', success: 'Archived' }}
/>;

Examples

Confirm and Disabled. Use Fail next action on Confirm to see the retry state. The app and public preview use the same content and variant names. Demo settings sit outside the component and outcome feedback stays on the action.

Settings

SettingDefaultBehavior
labelsEnglish labelsIdle/pending/completed/error text, independently replaceable.
tone'primary'Shared Button tone for track, thumb and feedback.
hintShimmertrueAnimate the hint with the ambient text shimmer.
successMorphtrueExpand the successful thumb to fill its track.
classNameundefinedRoot styling escape hatch.
styleundefinedRoot native styles.
accessibilityLabelcurrent labelOverride the spoken action.
onConfirmabsentConfirmation work; return a promise to show pending.
confirmedundefinedControlled completion state.
defaultConfirmedfalseInitial uncontrolled completion.
onConfirmedChangeundefinedReceives completed confirmation.
threshold0.95Fraction of available thumb travel needed for acceptance.
detents4Number of haptic progress divisions.
rubberBandtrueAllow elastic travel beyond the endpoints.
minPending450Minimum pending feedback, milliseconds.
onErrorundefinedReports work failure; the next slide can retry.
disabledfalseDisable activation and cancel an active drag.
hapticstrueIndependent drag/confirm/result feedback or a global switch.
motionapp feelShared motion feel.
testID'slide-confirm'Identifier for the gesture recognizer.
haptics.dragtrueSelection ticks across progress divisions.
haptics.confirmtrueImpact for accepted confirmation intent.
haptics.resulttrueSuccess or error outcome notification.

Composition and behavior

threshold is in (0,1], detents is a positive integer and minPending is milliseconds. A plain view writes both a JS measurement ref and UI shared width; JavaScript confirmation never reads a just-written shared value. Native accessibility exposes Confirm directly. Physical arbitration, haptics and native performance remain 7.9 checks.

A measured thumb accepts at threshold of available travel, with independently configured detents and rubberBand behavior.

Early release returns with release velocity; taps that never activate the pan cannot confirm. RTL mirrors physical travel.

Async work is serial, reports pending/results and allows a fresh slide after failure. hintShimmer and successMorph are independent; shared ambient lifecycle pauses the hint.

API reference

PropTypeDefaultDescription
onConfirm() => void | Promise<void>—

Confirmation work; return a promise to show pending.

confirmed?booleanundefined

Controlled completion state.

defaultConfirmed?booleanfalse

Initial uncontrolled completion.

onConfirmedChange?((confirmed: boolean) => void)undefined

Receives completed confirmation.

threshold?number0.95

Fraction of available thumb travel needed for acceptance.

detents?number4

Number of haptic progress divisions.

rubberBand?booleantrue

Allow elastic travel beyond the endpoints.

minPending?number450

Minimum pending feedback, milliseconds.

resetAfter?number | false1800

Successful feedback lifetime in milliseconds; false retains completion.

onError?((error: unknown) => void)undefined

Reports work failure; the next slide can retry.

disabled?booleanfalse

Disable activation and cancel an active drag.

haptics?uniontrue

Independent drag/confirm/result feedback or a global switch.

motion?MotionOverrideapp feel

Shared motion feel.

testID?string'slide-confirm'

Identifier for the gesture recognizer.

labels?Partial<object>English labels

Idle/pending/completed/error text, independently replaceable.

tone?ButtonTone'primary'

Shared Button tone for track, thumb and feedback.

hintShimmer?booleantrue

Animate the hint with the ambient text shimmer.

successMorph?booleantrue

Expand the successful thumb to fill its track.

className?stringundefined

Root styling escape hatch.

style?StyleProp<ViewStyle>undefined

Root native styles.

accessibilityLabel?stringcurrent label

Override the spoken action.

Review gates

Founder app and existing pnpm-dev visual acceptance remains open. Native runtime, VoiceOver/TalkBack, haptics, motion, Dynamic Type, RTL and recordings remain pending founder-scheduled 7.9. Source, bundle and unit checks do not establish visual or native acceptance.

SettingDefaultBehavior
resetAfter1800Successful feedback lifetime in milliseconds; then return to the normal track. false retains completion.

Automatic return only resets presentation; it does not undo or repeat the action. Controlled owners receive onConfirmedChange(false) and keep final authority. Timer callbacks use current handlers without restarting the deadline. The handle follows the full measured track directly during a web drag; the release spring and native motion feel remain separate.

Behavior and gestures

  • A measured thumb accepts at threshold of available travel, with independently configured detents and rubberBand behavior.
  • Early release returns with release velocity; taps that never activate the pan cannot confirm. RTL mirrors physical travel.
  • Async work is serial, reports pending/results and allows a fresh slide after failure. hintShimmer and successMorph are independent; shared ambient lifecycle pauses the hint.
  • Success remains visible for resetAfter (1800ms by default), then the control morphs back without repeating the action. false retains completion; controlled owners receive a false request. Native thumb geometry is independent of the padded label area.

Accessibility

  • Named controls expose unavailable, busy and selected/progress state where applicable. Decorative layers are excluded from interaction.
  • Meaningful outcome/availability announcements are distinct from clocks and decorative effects. Native VoiceOver/TalkBack, Dynamic Type, RTL and touch evidence remain pending for 7.9.

Motion

  • Uses the press, morph, number and ambient motion roles, so it follows your app's feel. Pass motion to tune this one instance.
  • Every decorative duration/spring comes from the shared role helpers. Content clocks remain independent of motion feel.
  • Reduce Motion retains readable outcome/progress feedback. Native motion/performance review remains pending.

Performance

  • No new package, network service, telemetry or proprietary source.
  • Async results and content timers clean up or invalidate after unmount; UI animation values stay on the UI thread.

Notes for AI

  • threshold is in (0,1], detents is a positive integer and minPending is milliseconds. A plain view writes both a JS measurement ref and UI shared width; JavaScript confirmation never reads a just-written shared value. Native accessibility exposes Confirm directly. Physical arbitration, haptics and native performance remain 7.9 checks.
  • Founder app/web acceptance and all native runtime, accessibility, haptics, motion and recordings remain pending for 7.9.

Compatibility

Runs onSupported
Expo SDK 57Yes
Expo SDK 58Yes
React Native CLI (with Expo modules)Yes
Expo GoYes
iOSYes
AndroidYes

This table describes API support and static bundle checks. Native runtime, device accessibility and bare Uniwind compatibility remain pending.

Related items