# Gesture onboarding

> An onboarding carousel where each slide teaches a gesture (swipe, press and hold, double tap, pull to refresh). A hand shows each gesture on a real piece of interface, and the slide completes when you do the gesture yourself.

- Type: Component (special)
- Access: Arc Pro
- Page: https://uiarc.dev/components/gesture-onboarding
- Markdown: https://uiarc.dev/components/gesture-onboarding/markdown
- Source file: `registry/components/gesture-onboarding/gesture-onboarding.tsx`
- Dependencies: motion, lucide-react
- Keywords: special, onboarding, gestures, touch, motion, new, gesture, tutorial, coach marks, first run, swipe, long press, press and hold, double tap, pull to refresh, hand hint, walkthrough, carousel

## When to use

- Teaching hidden gestures on first run: swipe to archive, press and hold to peek, double tap to like, pull to refresh.
- Announcing a new gesture in a release, with a chance to try it safely before using it on real data.

## When not to use

- Use onboarding-tour to point at real controls in the live interface, or onboarding-checklist for setup tasks.
- Avoid it for mouse-first desktop apps where the same actions have visible buttons; teach the buttons instead.

## Installation

Gesture onboarding is part of Arc Pro. The live preview is public; the source and install command need Pro.

### CLI with a Pro token

1. Create a token in your account and set it in the environment (or `.env.local`). Never commit it.

```bash
export ARC_PRO_TOKEN=arc_pro_...
```

2. Add the Pro registry to `components.json`:

```json
{
  "registries": {
    "@uiarc": "https://uiarc.dev/r/{name}.json",
    "@uiarc-pro": {
      "url": "https://uiarc.dev/r/pro/{name}.json",
      "headers": {
        "Authorization": "Bearer ${ARC_PRO_TOKEN}"
      }
    }
  }
}
```

3. Install:

```bash
npx shadcn@latest add @uiarc-pro/gesture-onboarding
```

### Manual

Signed-in Pro members can copy the source from the Manual tab on the docs page.

- Plans: https://uiarc.dev/pricing
- Create a Pro token: https://uiarc.dev/account#pro-access
- Setup guide: https://uiarc.dev/docs/ai#pro-access

## Usage

```tsx
import { GestureOnboarding, defaultGestureSteps } from "@/components/arc/gesture-onboarding/gesture-onboarding";

export function FirstRun({ onDone }: { onDone: () => void }) {
  return <GestureOnboarding
    steps={defaultGestureSteps.filter(step => step.gesture !== "double-tap")}
    onStepComplete={step => track("gesture_learned", { id: step.id })}
    onComplete={onDone}
  />;
}
```

## API reference

### GestureOnboarding

An onboarding carousel that teaches gestures by doing them. Each slide puts a real piece of interface on a small stage (an inbox, a photo album, a post, an activity feed) and a glassy hand demonstrates the gesture on it in a seamless loop: the message follows the finger and reveals Archive, a ring fills under a held thumb, two ripples mark a double tap, the list stretches down on a rubber band. When you perform the gesture yourself the scene answers physically (the message flies off and the list closes its gap, the photo lifts into a peek with a glass menu, a heart pops and the count ticks up, the spinner spins and a new row slides in), the step is checked off, and the carousel glides to the next one. A summary slide closes the tour.

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `steps` | `GestureStep[]` | `Swipe, press and hold, double tap, pull to refresh` | Slides in order. Each step has id, gesture ("swipe" \| "hold" \| "double-tap" \| "pull"), label for the step list, title, description, prompt shown until it is done, and success shown after. |
| `defaultStep` | `number` | `0` | Index of the first slide. |
| `autoAdvance` | `boolean` | `true` | Glide to the next slide 1.3 seconds after a gesture is done. The primary button also turns from Skip into Next. |
| `speed` | `number` | `1` | Speed of the hand hint. 0 holds it in its key pose. |
| `paused` | `boolean` | `false` | Holds the hand hint in its key pose, mid gesture. The gestures themselves still work. |
| `accent` | `string` | – | Color of the prompt, touch ripples, trail, hold ring, archive action, like, and done marks. Defaults to the accent token. |
| `labels` | `{ skip?; next?; finish?; restart?; doneTitle?; doneDescription?; steps? }` | – | Visible words, for localization. |
| `label` | `string` | `"Gesture onboarding"` | Accessible name of the carousel. |
| `onStepComplete` | `(step: GestureStep, index: number) => void` | – | Called once when a step's gesture is performed. |
| `onComplete` | `() => void` | – | Called when the last slide is passed and the summary shows, by finishing or skipping. |
| `className` | `string` | – | Extra class on the root. |
| `style` | `CSSProperties` | – | Inline styles on the root. |

## Keyboard interactions

| Keys | Action |
| --- | --- |
| Tab | Moves from the practice target on the current slide to the step list and the primary button. Slides that are not shown are inert. |
| Left arrow, Delete, or Backspace | On the inbox: archives the unread message. |
| Space or Enter (held) | On the album photo: fills the hold ring while held and opens the peek. Press again or Escape to close it. |
| Enter or Space twice | On the post: likes it, the same as a double tap. |
| Down arrow, Enter, or Space | On the activity list: refreshes it. |
| Arrow keys, Home, End | In the step list: moves between steps and the carousel follows. |

## Accessibility

- The root is a section with aria-roledescription carousel. Each slide is a group with aria-roledescription slide and a name such as "2 of 4: Press and hold". Slides that are not current are inert.
- Each practice surface is a real focusable button with a specific name ("Unread message from Marcus Johnson: Build 2.4 is ready to test") and a description that holds the prompt and its keyboard equivalent.
- The step list is a tablist; each tab's name includes "done" once the gesture is performed. On narrow widths the tabs are dots with the label kept for assistive technology.
- A polite live region announces the new step and its prompt on navigation, each success ("Archived. Step done."), and the summary.
- Done is never color alone: the prompt swaps to a check and a success word, the step indicator turns into a check, and the button changes from Skip to Next.
- The hand, trail, ripples, and ring are decorative SVG hidden from assistive technology. Pointer focus draws no ring; keyboard focus shows Arc's shared focus ring.

## Motion

- One rAF loop drives the carousel, every scene, and every hint. It steps small spring integrators and writes transforms, opacity, and SVG attributes straight to the DOM through a cache that skips unchanged values; React renders only when the step or a done flag changes.
- Each hint is a pure function of time on a seamless loop: the hand fades in slightly large, presses down with a ripple, travels its path on an ease in out curve while the target follows it (the row slides 1:1, the list follows through the same rubber band the real drag uses), lifts, and fades before the target has settled back. Loops start and end at rest, so there is never a seam.
- Touching a scene hands it straight to your finger: the hint's current offset is baked into the physics so nothing jumps, and the hand fades out on a snappy spring. It comes back 2.4 seconds after you stop, from the start of its loop.
- Swipe: past a threshold the archive icon pops; release or flick and the row flies off with its throw velocity, then the rows below close the gap. Hold: the thumbnail sinks slightly while the ring fills, then lifts on a lightly underdamped spring into the peek while the album blurs behind it. Double tap: a white heart pops with a bounce at the tap point and floats away; the small heart pulses. Pull: the list stretches on a rubber band, the spinner draws in with the pull and turns accent when armed, spins while it refreshes, and a new row slides in.
- The carousel moves every slide on one critically damped spring with a slight depth scale, and the copy crossfades with it, so rapid navigation is always interruptible.
- The loop pauses off screen through an IntersectionObserver and in hidden tabs, and sleeps whenever nothing moves. Reduced motion freezes each hint in its key pose (mid swipe, a ring two thirds full, two ripples, a list mid pull) and lands every result instantly.

## Responsive behavior

- Each stage is a 10:9 container and every scene is laid out in container units, with the hand and effects in an SVG viewBox, so the whole scene scales as one at any width.
- Below 600px the stage sits above the copy with dot tabs and one button; from 600px the stage moves left and the copy, a labelled step list, and the button sit on the right.
- Touch: the inbox keeps vertical page scroll (pan-y), the post disables double tap zoom, and the activity list captures the drag so pulling never scrolls the page. Long press never opens the browser callout.

## Performance

- Only transforms, opacity, and SVG attributes change per frame, and each write is skipped when its value has not changed. Slides more than one position away are hidden.
- The album uses nine photos, lazily loaded. Pass smaller images through your own steps if the tour opens on a slow connection.

## Notes for AI

- Use it for first run in a touch-first product, or when shipping a new gesture that is otherwise invisible. Keep it to three to five steps; each should unlock something the person will actually do next.
- Pick steps from the four built-in gestures and write the copy for your product. The practice scenes use sample content; they never touch real data, so nothing is archived, liked, or refreshed for real.
- Store completion from onStepComplete and onComplete so the tour does not show again, and offer a way to replay it from settings.
- Put it in a dialog, a bottom sheet, or a full screen first-run route. It fills its container and switches to a side-by-side layout from 600px.

## Related

- [Onboarding checklist](https://uiarc.dev/components/onboarding-checklist/markdown): Guide a new workspace through setup, one step at a time.
- [Swipe actions](https://uiarc.dev/components/swipe-actions/markdown): Reveal row actions with a swipe, or from the same actions in a menu.
- [Carousel](https://uiarc.dev/components/carousel/markdown): Browse a row of slides by dragging, flicking, or arrowing through them.
- [Hold to confirm](https://uiarc.dev/components/hold-to-confirm/markdown): Confirm a destructive action by holding, not tapping.

## Also in cursor

- [Dot grid](https://uiarc.dev/components/dot-grid/markdown): A dot field that bulges around the cursor like a lens and ripples from every click.
- [Image trail](https://uiarc.dev/components/image-trail/markdown): Moving the pointer leaves a curated trail of photos that pop in, lean, and fade away.
- [Gravity well](https://uiarc.dev/components/gravity-well/markdown): A grid of tiles that bends toward the cursor like spacetime, with a click that sends a shockwave through it.
- [Ink fluid](https://uiarc.dev/components/ink-fluid/markdown): A real time fluid simulation behind your hero: the cursor stirs soft ink that swirls, settles and fades; calm when left alone.
- [Cursor trail draw](https://uiarc.dev/components/cursor-trail-draw/markdown): A whiteboard where ink is smoothed and shaped by pressure, a laser pointer leaves a fading trail, and rough circles, boxes, triangles and lines snap to clean shapes on a small spring when the pen lifts.

## Guidance for AI tools

Gesture onboarding: An onboarding carousel where each slide teaches a gesture (swipe, press and hold, double tap, pull to refresh). A hand shows each gesture on a real piece of interface, and the slide completes when you do the gesture yourself. Follow the declared prop types and do not invent props. Keep keyboard access, reduced motion support, and both light and dark themes intact when adapting it.

Full library index: https://uiarc.dev/llms.txt
