# Slide to Confirm — React Native component for Expo

> A slide-to-pay track whose thumb drags a glowing trail and ticks with haptics.

Slide-to-pay track: drag the thumb and a glowing trail follows it towards a target that lights up, with haptic ticks along the way. Every look follows the accent as one solid colour (with an opt-in gradient variant); success draws a check, a failed onConfirm shakes the track and slides back.

- Docs: https://expokit.in/docs/components/slide-to-confirm
- Tier: Pro (ExpoKit Pro plan)
- Also called: swipe-to-confirm button, slide to unlock, swipe button
- Category: Buttons
- Platforms: iOS, Android, web
- Expo Go: yes, no development build needed
- npm dependencies: react-native-svg, expo-haptics
- Uses ExpoKit items: kit
- Variants: Default, Gradient, Outline, Compact, Colors, Async Transfer, Error State

## Installation

This component is part of ExpoKit Pro. With a Pro plan, log the CLI in once and add it like any other item:

```bash
npx @expokit/cli@latest login
```

Plans: https://expokit.in/pricing

## Props

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `label` | `string` | `labels.slideToConfirm` | Shimmering text in the track. |
| `confirmedLabel` | `string` | `labels.confirmed` | Text once completed. |
| `onConfirm` | `() => void \| Promise<unknown>` | — | Fires at the end. Return a promise to show a spinner in the thumb; a rejection shakes the track, flashes the danger colour and slides back. |
| `variant` | `"default" \| "gradient" \| "outline" \| "compact"` | `"default"` | Tinted track with a solid thumb, opt-in two-tone gradient track with a white thumb, transparent track with a tinted hairline, or a 48pt slim track. |
| `accent` | `string` | `theme accent` | Thumb, trail and track colour; only the gradient variant derives a second tone from it. |
| `icon` | `ReactNode` | `animated chevrons` | Custom thumb icon. |
| `resetAfter` | `number` | — | Auto-reset after this many ms. Otherwise call ref.reset(). |
| `threshold` | `number` | `0.82` | Fraction of the track that confirms on release. |
| `haptics` | `boolean` | `true` | Ticks at 25 / 50 / 75 %, success on confirm, error on failure. |
| `disabled` | `boolean` | `false` | Locks the thumb. |
| `ref` | `{ reset(): void }` | — | Imperative reset. |
| `style` | `StyleProp<ViewStyle>` | — | Style for the track (merged over its height, radius and colour). |
| `className` | `string` | — | Tailwind classes on the root when using NativeWind or Uniwind. Prefer style for StyleSheet overrides. |

## Behaviour & accessibility

- **Touch**: Drag past the threshold, or flick fast past the halfway point, to confirm; anything less springs back. If onConfirm returns a promise the thumb spins until it settles.
- **Motion**: The thumb swells while held and a check draws on success; a rejected promise shakes the track and slides it back.
- **Reduced motion**: The idle nudge and the chevron shimmer on the thumb are turned off.
- **Haptics**: Selection ticks at 25, 50 and 75 percent of the drag, a medium impact on release, then a success or error notification.
- **Screen readers**: A button whose label switches to confirmedLabel when done, with busy and disabled state. The 'activate' action (double tap) confirms without dragging.

## FAQ

### How do I make a swipe-to-confirm button in React Native?

Use ExpoKit's Slide to Confirm, a Pro component: with ExpoKit Pro, the ExpoKit CLI copies a ready-made swipe-to-confirm button into your Expo or React Native app as plain TypeScript you can edit. It works on iOS, Android and web, and in Expo Go.

### Does Slide to Confirm work in Expo Go?

Yes. Slide to Confirm runs in Expo Go on iOS and Android with no development build — its packages (react-native-svg, expo-haptics) are all included in Expo Go.

### How do I add Slide to Confirm to my Expo app?

With ExpoKit Pro, add it with the ExpoKit CLI: it copies the component's source into your app and installs react-native-svg, expo-haptics, so the code is yours to change. The install command is on this page for Pro members.

### Is Slide to Confirm free?

Slide to Confirm is part of ExpoKit Pro. With a Pro plan, log the CLI in once and it installs the full source into your app.

### Can I change how Slide to Confirm looks?

Yes. It takes its colours, radius and light / dark mode from useKit(), so wrapping your app in <KitProvider accent radius> re-skins it with every other ExpoKit component. The code lives in your project, so you can also edit anything directly.

## More

- Live preview, variants and code: https://expokit.in/docs/components/slide-to-confirm
- Every ExpoKit component, screen, template and chart: https://expokit.in/llms.txt
- Install commands and props for every free component: https://expokit.in/llms-full.txt
- Pricing: https://expokit.in/pricing
