# vue-detour

> Introduce users to your app by taking them on a detour.

Latest version **1.0.2** (published 2022-06-12) · MIT license · 0 weekly downloads

## Install

```sh
npm install vue-detour
pnpm add vue-detour
yarn add vue-detour
bun add vue-detour
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2022-06-12 |
| First published | 2022-04-26 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=16 |
| Dependencies | 2 |
| Unpacked size | 89.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Hayden Woods |
| Maintainers | haydenwoods |
| Keywords | vue, vue3, javascript, js, typescript, ts |

## Links

- npm: https://www.npmjs.com/package/vue-detour
- Repository: https://github.com/haydenwoods/vue-detour
- Issues: https://github.com/haydenwoods/vue-detour/issues
- npm.io page: https://npm.io/package/vue-detour

## Dependencies (2)

- [vue](https://npm.io/package/vue.md) ^3.2.25
- [@popperjs/core](https://npm.io/package/@popperjs/core.md) ^2.11.5

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 1.0.2 (latest) — 2022-06-12
- 0.0.5 (alpha) — 2022-04-26
- 1.0.1 — 2022-06-11
- 1.0.0 — 2022-05-01
- 0.0.11 — 2022-04-29
- 0.0.10 — 2022-04-27
- 0.0.9 — 2022-04-27
- 0.0.8 — 2022-04-26
- 0.0.7 — 2022-04-26
- 0.0.6 — 2022-04-26
- 0.0.4 — 2022-04-26
- 0.0.3 — 2022-04-26

## README

# Vue Detour

Introduce users to your app by taking them on a detour.

## Getting started

Vue-detour can be installed via NPM.

```
npm install vue-detour
```

## Usage

```html
<template>
  <!-- Steps -->
  <div id="step-1"></div>
  <div id="step-2"></div>

  <!-- Tooltip -->
  <div v-if="!detour.isHidden" id="tooltip">
    <h1>
      {{ detour?.currentStep?.props?.title }}
    </h1>

    <p>
      {{ detour?.currentStep?.props?.body }}
    </p>

    <button v-if="!detour.isFirstStep" @click="detour.previousStep">
      Previous
    </button>

    <button v-if="!detour.isLastStep" @click="detour.nextStep">
      Next
    </button>

    <button @click="detour.skip">
      {{ detour.isLastStep ? "Finish" : "Skip" }}
    </button>
  </div>
</template>

<script setup lang="ts">
import { useDetour } from "vue-detour";

const detour = useDetour({
  tooltip: "step-1", // CSS query selector string for the tooltip
  steps: [
    {
      target: "#step-1", // CSS query selector string for the step
      placement: "top-end", // Optional placement
      offset: [0, 24], // Optional offset
      props: { 
        title: "Title",
        body: "Body",
      },
    },
    {
      target: "#step-2", // CSS query selector string for the step
    },
  ],
  options: {
    defaultPlacement: "auto", // Default placement, overriden by individual step placement
    defaultOffset: [0, 8], // Default offset, overriden by individual step offset
    startImmediately: true, // Start detour immediately
    scrollToTopOnFinish: true, // Scroll to the top of the page on detour finish
    persistence: { // Persist state of detour to storage, boolean or persistence options
      type: "local", // LocalStorage or SessionStorage
      key: "home", // Storage key
      version: "0.0.1", // Incrementable version
    },
  },
});
</script>
```

---
_Source: https://npm.io/package/vue-detour · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
